Remembering and removing price

 

Hello dear programmers,

I am building an EA based on my strategy but as I am still learning how to code properly I ran into some troubles. Would really appreciate your help!

So basically lets say that my strategy generates  SELL signals at the price of X and then Y and then Z and so on. How can I code it so that the EA will remember price X, Y, Z... and only remove those levels after a candle has closed above their value? (vice versa for BUY of course) 


Thank you in advance for your ideas! 

 

Hi Matic...

Just create 'Double' variables for each one and then 're-set' those variables to '0' on the iOpen of the the next candles... something like this:

double BuySignalX = (your condition X value);
double BuySignalY = (your condition Y value);
double BuySignalZ = (your condition Z value);

if(iOpen(0) > BuySignalX) BuySignalX=0;
if(iOpen(0) > BuySignalY) BuySignalY=0;
if(iOpen(0) > BuySignalZ) BuySignalZ=0;

A very basic idea of how I would go about it... but, you should be able to code it better into a 'for' or 'while' loop....

Hope that helps in some way...