Download MetaTrader 5
To add comments, please log in or register
Do you have Linux? Find out how to install MetaTrader on it!
ankityadav
208
ankityadav 2014.03.24 10:29 
HI,Can some solve my problem please find the attach .Actaully what i m trying to do is to print the horizontal line and if you see the image it does print the line but i want to print the line on the same point when cross occur and another thing and also i don't want lines when there is no cross if you see there is line happenning whenever there is no cross occur so i have to remove that thing also can somebody help me to solve this issues
whroeder1
13640
whroeder1 2014.03.24 13:43  
whroeder1
13640
whroeder1 2014.03.24 19:13  
ankityadav: need a horizontal lines when ever the two line crosses each other a
     if(fastsma>=slowsma)
You check for fast above or below slow, not a cross of fast and slow
    double fastsma=iBands(NULL,0,InpFastSMA,Inpdev,0,PRICE_CLOSE,MODE_SMA,limit);
    double slowsma =iBands(NULL,0,InpSlowSMA,Inpdev,0,PRICE_CLOSE,MODE_SMA,limit);
    ExtBuffer1[limit]=fastsma;
    ExtBuffer2[limit]=slowsma;
     if(fastsma>=slowsma)
You want a line when they cross.
    double fastsma=iBands(NULL,0,InpFastSMA,Inpdev,0,PRICE_CLOSE,MODE_SMA,limit); 
    double slowsma =iBands(NULL,0,InpSlowSMA,Inpdev,0,PRICE_CLOSE,MODE_SMA,limit);
    ExtBuffer1[limit]=fastsma;                                                    
    ExtBuffer2[limit]=slowsma;                                                    

    double fastPre=iBands(NULL,0,InpFastSMA,Inpdev,0,PRICE_CLOSE,MODE_SMA,limit+1),
           slowPre=iBands(NULL,0,InpSlowSMA,Inpdev,0,PRICE_CLOSE,MODE_SMA,limit+1);
    bool wasAbove = fastPre > slowPre,
          isAbove = fastsma > slowsma,
         isCross = wasAbove != isAbove;
  if(isCross){                 test for a cross
     if(fastsma>=slowsma)                                                         
      :
//   else if(fastsma<=slowsma) unnecessary test removed
     else
      :
  }
ankityadav
208
ankityadav 2014.03.24 20:42  

: Hi Thanks for your valuable answer i will use it and get back to you and again very thankful for you . Yes i did a mistake and thanks for your concern again again thankfull to you WHRoeder

ankityadav
208
ankityadav 2014.03.25 08:47  
: HI its working thanks again but can you let me know if i want to show lines depending upon bars let say there were 100 bars and i want to see only lines in past 50 bars what i need to use.ThanksWHRoeder
whroeder1
13640
whroeder1 2014.03.25 12:48  
ankityadav: i want to see only lines in past 50 bars what i need to use.T
a trend line instead of a hline
/
To add comments, please log in or register