English

## Momentum Prices

 49 maleas_k 2014.02.28 12:26   Hello There Here I am again trying another strategy and facing new issues. I am importing in an array market prices and Momentum prices using 7 different mom periods 10,55,89,144,233,377,610 in 3 different positions. The issue is that I don’t take mom prices for 233,377 and 610 for the last 2 position. Every position needs at least the periods in candles plus the previous position. For example ds_array_ATF[0][10][4] needs 610 Candles / Periods, ds_array_ATF[1][10][4] needs 610 * 2 Candles / Periods, ds_array_ATF[2][10][4] needs 610 *3 Candles / Periods. I have come to a conclusion that mom fails to count all this Candles / Periods so it doesn’t return any value. Can anyone imagine something else or knows any solution ? Thanks in advance. Hera is my code… ```//+------------------------------------------------------------------+ //|                                        Mom Fibo Trading v1_3.mq4 | //|                                                     Trading Team | //|                                                                  | //+------------------------------------------------------------------+ #property copyright "Trading Team" #property link      "" #include #include #include extern double percent_depo = 15;        double  long_order[4][4],             short_order[4][4];        int  long_order_mom,         short_order_mom;        int  long_order_again,       short_order_again;        int  long_order_mom_again,   short_order_mom_again;        int  no_close1, no_close2,   no_close3,no_close4;     double  lot_size = 1;     double  take_profitS = 500, take_profitSmom = 500, take_profit = 900, stop_loss =500,stop_lossS = 360,stop_lossSmom = 50;// an tha bgalei error ennoo     string  comments = "";      double startlong;    int mom_timeframe,  mom_applied_price;    extern int mom_period;    //--- Finding  Tops & Bottoms for 4H ------------------------------           int  ds_position;                      //------ Pointer of ds_array[][]        double  ds_array_ATF[20][30][20];        //------ DonchianSwing ARRAY [X][0]=VALUE & [X][1]= 1 top_4H / 0 BOTTTOM -- //-- Donchian  for 4H ---------------------------------------------    extern int  ds_periods=6;                    //------ Donchian Swing Periods           int  ds_timeframe = PERIOD_H1; double money_management() {    double lot;    double min_lot = MarketInfo(Symbol(),MODE_MINLOT);    double max_lot = MarketInfo(Symbol(),MODE_MAXLOT);    string symb    = Symbol();    double one_lot = MarketInfo(symb,MODE_MARGINREQUIRED);    double step    = MarketInfo(symb,MODE_LOTSTEP);    double free    = AccountFreeMargin();    if ( percent_depo > 100.0 ) percent_depo=100.0;    if ( percent_depo==0.0 )    lot=min_lot;    else                        lot=MathFloor((free*(percent_depo/100.0))*0.001);    if ( lot>max_lot ) lot = max_lot;    if ( lot0)       {          ds_array_ATF[ds_position][snd_position][tf] = x;          ds_array_ATF[ds_position][snd_position+10][tf] = z;          //------- Finding if it's top_1D or bottom_1D ---------------------          if ( ds_array_ATF[ds_position-1][snd_position][tf] > ds_array_ATF[ds_position][snd_position][tf])             { ds_array_ATF[ds_position-1][snd_position+20][tf] = 1; ds_array_ATF[ds_position][snd_position+20][tf] = 0; db++; }          else             { ds_array_ATF[ds_position-1][snd_position+20][tf] = 0; ds_array_ATF[ds_position][snd_position+20][tf] = 1; dt++; }          ds_position++;        //Alert("ds_position ",ds_position," snd_position : ",snd_position);       }       if ( db >=depth && dt >=depth ) i=3001;    } } int ds(int c) {    string txt;    switch(c)    {       case 0 : txt = 10; break;       case 1 : txt = 55; break;       case 2 : txt = 89; break;       case 3 : txt = 144; break;       case 4 : txt = 233; break;       case 5 : txt = 377; break;       case 6 : txt = 610; break;    }    return(txt); } //+--------------- Start -----------------------------------------------------------+ int start() {    int   i,z,limit;    int   last_trade,  last_trade_mom, last_trade_short, last_trade_short_mom;          comments = "";    for( i=0; i<=6; i++ )    find_ds_top_bottom(3,i,i,i,4);    for( z=0; z<=6; z++ )    {       comments = comments + "\n---------- DS " + ds(z) + "-----------";       comments = comments + "\nDS["+(0)+"]["+(z)+"][4] : " + ds_array_ATF[0][z][4] + " DS["+(1)+"]["+(z)+"][4] : " + ds_array_ATF[1][z][4] + " DS["+(2)+"]["+(z)+"][4] : " + ds_array_ATF[2][z][4] + "\n";       comments = comments + "\nMOM["+(0)+"]["+(z+10)+"][4] : " + ds_array_ATF[0][z+10][4] + " MOM["+(1)+"]["+(z+10)+"][4] : " + ds_array_ATF[1][z+10][4] + " MOM["+(2)+"]["+(z+10)+"][4] : " + ds_array_ATF[2][z+10][4] + "\n";       comments = comments + "\nT/B["+(0)+"]["+(z+20)+"][4] : " + ds_array_ATF[0][z+20][4] + " T/B["+(1)+"]["+(z+20)+"][4] : " + ds_array_ATF[1][z+20][4] + " T/B["+(2)+"]["+(z+20)+"][4] : " + ds_array_ATF[2][z+20][4] + "\n";    }    comments = comments + "\n---------------------";    comments = comments + "ds_array_ATF[0][4][4] : " + ds_array_ATF[0][4][4] + "\n";    comments = comments + "ds_array_ATF[0][5][4] : " + ds_array_ATF[0][5][4] + "\n";    comments = comments + "ds_array_ATF[0][6][4] : " + ds_array_ATF[0][6][4] + "\n";    comments = comments + "ds_array_ATF[0][14][4] : " + ds_array_ATF[0][14][4] + "\n";    comments = comments + "ds_array_ATF[0][15][4] : " + ds_array_ATF[0][15][4] + "\n";    comments = comments + "ds_array_ATF[0][16][4] : " + ds_array_ATF[0][16][4] + "\n";    Comment(comments); }```
 3134 qjol 2014.02.28 13:20 #   maleas_k: For example ds_array_ATF[0][10][4] needs 610 Candles / Periods, ds_array_ATF[1][10][4] needs 610 * 2 Candles / Periods, ds_array_ATF[2][10][4] needs 610 *3 Candles / Periods. i didnt read ur code yet but the question begins, do u have enough history data for that
 49 maleas_k 2014.02.28 14:10 #   qjol: i didnt read ur code yet but the question begins, do u have enough history data for that Yes I do. I import every month data that begins from 02/01/2001 and works perfectly in any other occasions. That makes me very confident about my data cause I test many EAs every day.
 3134 qjol 2014.02.28 14:23 #   i was more than happy to try helping u but i don't have the file "DonchianSwing_v2" `iCustom(Symbol(),ds_timeframe,"DonchianSwing_v2",ds_periods,0,i);`
 49 maleas_k 2014.02.28 15:05 #   qjol: i was more than happy to try helping u but i don't have the file "DonchianSwing_v2" oooopsssss Attached files:   donchianswing_v2.mq4  (6.78 KB)
 3134 qjol 2014.02.28 15:17 #   can you pinpoint the problem ?
 49 maleas_k 2014.02.28 15:31 #   qjol: can you pinpoint the problem ? At your pic there isn't any. Check out mine...
 3134 qjol 2014.02.28 15:37 #   o ye i forgot to mention @ first, i had the same problem, but i forced MetaTrader to download more history data & as i asked @ the beginning before reading & testing ur code qjol: i didnt read ur code yet but the question begins, do u have enough history data for that
 49 maleas_k 2014.02.28 15:52 #   qjol: o ye i forgot to mention @ first, I had the same problem, but I forced MetaTrader to download data more history & as I asked @ the beginning I insist about the data. At this point i have to mention that i am talking about Back Test and not Live. Because at live is ok. Check Pic....
 49 maleas_k 2014.03.01 12:52 #   Anybody...?