mylasttradeprice ??
Hi
I am trying trouble with the following piece of code.
..
static double firstbuysl, firstsellsl, firstbuyprice, firstsellprice;
static double mylasttradeprice = 0;
double sarCurrent, sarPrevious, momCurrent, momPrevious,x,y,t;
...
x = mylasttradeprice - (Bid + Ask)/2;
y = MathAbs(x);
t= (trailingStop/2)*Point;
if(y>t) { ....
/* determine how to trade */
..
if trailingstop = 30 then when the EA starts, I thought y would be greater then t and I would enter the section to 'determine how to trade' - but its not working.Hi cardio,
I've tested your code and found (y>t) evaluated to true(y is greater than t). So, you have to enter the section of 'determine how to trade'.
I used this code which will Alert 1 (true) if y>t and 0 (false) otherwise:
static double mylasttradeprice = 0;
double sarCurrent, sarPrevious, momCurrent, momPrevious,x,y,t;
dobule trailingStop = 30; //I declared it here for testing
x = mylasttradeprice - (Bid + Ask)/2;
y = MathAbs(x);
t= (trailingStop/2)*Point;
Alert(y>t); //trueI just want to know how do you set the mylasttradeprice?
thanks Coders' Guru
Thanks
I put the EA that uses this up at
https://www.mql5.com/en/forum/172896
it is serously not working - I don't quite know what is wrong - I will keep working on it.
Thanks
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
I am trying trouble with the following piece of code.
..
static double firstbuysl, firstsellsl, firstbuyprice, firstsellprice;
static double mylasttradeprice = 0;
double sarCurrent, sarPrevious, momCurrent, momPrevious,x,y,t;
...
x = mylasttradeprice - (Bid + Ask)/2;
y = MathAbs(x);
t= (trailingStop/2)*Point;
if(y>t) { ....
/* determine how to trade */
..
if trailingstop = 30 then when the EA starts, I thought y would be greater then t and I would enter the section to 'determine how to trade' - but its not working.