Just use a variable to hold the value of the Bid price at the last tick . . and compare it with the Bid price on the current tick . . .
Has to be a static or global so it's remembered between start() calls
int start(){ static double lastBid; if (Bid > lastBid){ Print("up tick"); .. } else{ Print("dn tick"); .. } lastBid = Bid; }
oh. AWESOME!
you guys make it look so easy !! :))
many thanks!
Dan
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello all,
Newbie here (bear with me) - I thought there should be some marketinfo constant to return the direction of last price change, I looked into this but could not sort it out: so what would you suggest as code for returning the sign of the last price change (both ask and bid)? I am trying to use it as a condition, but it looks like only MODE_ASK and MODE_BID are available. For example, I would need:
if ... "MODE_ASK (last tick) - MODE_ASK (the previous tick)" > 0 (i.e. if ASK price is increasing..)
then BUYSIGNAL
Many thanks!
Dan
edit
... ie. how to fill in the bit of "marketState" below (copypasted from here)