 
    Replies
                     Cerunnos
                     11 Nov 2013, 10:11
                                    
With the following basic structure of COG you should be able to complete your Robot:
// Center of Gravity by Belkhayate -----------------------------
[Parameter(DefaultValue = 3.0, MinValue = 1, MaxValue = 4)]
public int degree { get; set; }
[Parameter(DefaultValue = 120)]
public int period { get; set; }
[Parameter(DefaultValue = 1.4)]
public double strdDev { get; set; }
[Parameter(DefaultValue = 2.4)]
public double strdDev2 { get; set; }
[Parameter(DefaultValue = 3.4)]
public double strdDev3 { get; set; }
  //--------------------------------------------------------------
private double main;
private double red_1;
private double red_2;
private double red_3;
private double blue_1;
private double blue_2;
private double blue_3;
private BelkhayatePRC BEL;
protected override void OnStart()
        {         
            BEL = Indicators.GetIndicator<BelkhayatePRC>(degree, period, strdDev, strdDev2, strdDev3);       
        }
protected override void OnTick()
        {
            // COG main line
            main = BEL.prc[Index];
            // COG lines
            red_1 = BEL.sqh[Index];
            red_2 = BEL.sqh2[Index];
            red_3 = BEL.sqh3[Index];
            blue_1 = BEL.sql[Index];
            blue_2 = BEL.sql2[Index];
            blue_3 = BEL.sql3[Index];
            //your buy-condition...
            if (MarketSeries.Close[Index] > red_2)...
       }
 
@Cerunnos
                     Cerunnos
                     11 Nov 2013, 20:05
                                    
Add following code:
protected int Index 
        {
            get { return MarketSeries.Close.Count - 1; }
        }
For learning you should view the sample robots in the left column of cAlgo. And with <Search> you find a solution to almost any problem :-)
I can code your strategy, but then you have to pay for work.
@Cerunnos


ctrader44443123
11 Nov 2013, 03:20
RE:
DELETED
@ctrader44443123