Help in sorting out my sell buy conditions.

 

My first AE that uses a simple RSI trigger. When the RSI value is more than a certain level it wil either buy or sell. The buy or sell part is working - actually it is working to well.

I need the AE to enter only once on a sell and the next must be a buy and visa versa. The problem is the AE keeps on buying on buy conditions untill the conditions are right to sell again and visa versa.

Can anyone help me to correct this problem? I need my AE to only Buy when the conditions are right and the next condition must be a Sell condition only.

In other words it must be buy; sell; buy;sell or sell;buy sell;buy and NOT a buy; buy;buy;sell;sell;buy;sell cenario for example. Hope I make sense.

Help will be appreciated.

 

There are a few ways to accomplish what you want to do.... Simple way is to after the Buy(or Sell) order is placed to set either an int or bool to a condition and then check for that condition before placing another order... The other way that comes to mind is to loop and check...




if (whatever RSI condition triggers a buy)

if (lastbuy==0)

{

Ordersend more stuff buy order....;

lastbuy =1;

lastsell=0;

}


if (whateverRSI condition triggers a sell)

if(lastsell==0)

{

Ordersend....more stuff sell order....;

last buy=0;

lastsell=1;

}

 
n8937g wrote >>

There are a few ways to accomplish what you want to do.... Simple way is to after the Buy(or Sell) order is placed to set either an int or bool to a condition and then check for that condition before placing another order... The other way that comes to mind is to loop and check...

if (whatever RSI condition triggers a buy)

if (lastbuy==0)

{

Ordersend more stuff buy order....;

lastbuy =1;

lastsell=0;

}

if (whateverRSI condition triggers a sell)

if(lastsell==0)

{

Ordersend....more stuff sell order....;

last buy=0;

lastsell=1;

}

n8937g
wrote
>>

There are a few ways to accomplish what you want to do.... Simple way is to after the Buy(or Sell) order is placed to set either an int or bool to a condition and then check for that condition before placing another order... The other way that comes to mind is to loop and check...

if (whatever RSI condition triggers a buy)

if (lastbuy==0)

{

Ordersend more stuff buy order....;

lastbuy =1;

lastsell=0;

}

if (whateverRSI condition triggers a sell)

if(lastsell==0)

{

Ordersend....more stuff sell order....;

last buy=0;

lastsell=1;

}

Thank you for the reply, I will try and let jou know....much appreciated.

 

Ok, I need help - could not get the one buy or sell condiftion right.. i.e one buy and one sell only. I attached the code here - i used the molanis generator as well in order to see if i can sort it out and no luck - here is the molanis code...

Files:
 
george_davids:

Ok, I need help - could not get the one buy or sell condiftion right.. i.e one buy and one sell only. I attached the code here - i used the molanis generator as well in order to see if i can sort it out and no luck - here is the molanis code...

This is the compiled file, not the code!

The code ends in mq4 or mqh.

 
gordon wrote >>

This is the compiled file, not the code!

The code ends in mq4 or mqh.



Ok, pls see the text file i attached again?
 

Ok, pls see the text file i attached again?

Files:
 
george_davids:

Ok, pls see the text file i attached again?

Decompiled. Good luck.

Reason: