Need Help with EA to Buy then Sell using Alligator.

 

I have an EA that I used iExpertAdvisor software to code it but I still can't get it to work correctly.

Very simple concept. Using the alligator indicator I want to open a buy trade when the first candle opens above the Jaws for a set amount of takeprofit and stoploss.

But where I am having the problem is figuring out if I can set it to look only for Sell trades (when the first candle opens below the alligator) after a Buy trade has closed and visa versa.

Right now as soon as it closes an order it opens another one instantly. Don't want that.

I have looked for 2 weeks for some code that would do this and just spent $147.00 for this iExpertAdvisor software but I am about to pull my hair out now.

Needless to say I am not a coder, just trying to learn the basic. But I really want this EA to start testing.

Can anyone help PLEASE....

 

basically speaking you have to set a BOOLEAN to be true after a buy has been place and no additional buys get placed while it's true.

Boolean gets reset when SELL condition is met.

and do the opposite with another boolean variable after the sell is placed.

if that works, it'd be pretty simple

I've never heard of iExpertAdvisor, i'll have to go check that out

 

Actually SC that won't solve his problem.

Somebody with a similar problem has been given the correct solution on this thread...

https://www.forex-tsd.com/expert-advisors-metatrader-4/18948-code-help-avoid-re-entry.html

Hope that helps.

Lux

 

i don't know if that will solve this person's problem since that's based on re-opening on same bar only and this person wants based on cross up/down of a line. That could happen many bars after an order has closed

 

Thanks guys for your replies, I really thought this would be really simply to do but I guess not. Just can't get it to work, but I am going to keep looking and learning until I get it right,

Reason: