multiple problems with my EA

 

Hey guys... there are some issues in my ea that i can't solve or code them...

1. I coded a trailing stop, but it doesn't work right, for Ex, if we have buy position, and first and second trailing stop triggers, if price goes down, second trailing stop modified its price and it goes back to the first one or when the first trailing stop triggers if price goes down, first trailing stop modified its price and it goes back to the default SL.., how should i fix this problem.


2. Another problem in my ea is that it does not see my condition for starting an order (line 66 and 72) and it open trade on open[0], beside when for ex, it open a buy position and after some time if price goes down and pass the sell condition, it doesn't trigger sell order.


3. how should I make ea to see just part of balance when i back testing it.. what i want is when balance for ex, reach 12,000$ from 10,000$, i want to store 2000$ as profit and ea trade with the rest of balance again, and i want to print this profit on screen, and when it happens again, it store another 2000$, and shows me 4000$ on screen, and trade with the rest of balance again and so on...


ok, this is my ea, thank you guys...

Files:
 
mdswamp:

Hey guys... there are some issues in my ea that i can't solve or code them...

1. I coded a trailing stop, but it doesn't work right, for Ex, if we have buy position, and first and second trailing stop triggers, if price goes down, second trailing stop modified its price and it goes back to the first one or when the first trailing stop triggers if price goes down, first trailing stop modified its price and it goes back to the default SL.., how should i fix this problem.


2. Another problem in my ea is that it does not see my condition for starting an order (line 66 and 72) and it open trade on open[0], beside when for ex, it open a buy position and after some time if price goes down and pass the sell condition, it doesn't trigger sell order.


3. how should I make ea to see just part of balance when i back testing it.. what i want is when balance for ex, reach 12,000$ from 10,000$, i want to store 2000$ as profit and ea trade with the rest of balance again, and i want to print this profit on screen, and when it happens again, it store another 2000$, and shows me 4000$ on screen, and trade with the rest of balance again and so on...


ok, this is my ea, thank you guys...

Hi mdswamp

I think,you may go step by step.

first to see conditions for open trade/s ... an option for 1 trade at one time or multiple trades ..... if conditions met for buy,open buy .... and when conditions met for sell,close buy and open sell.

trailing and balance at some next stage .... i am not coder,just guessing from your explanations.

regards

 

Hi mntiwana, thanks for reply, finally i solved the first problem about trailing stop and now its working, but still i have problems in other parts.

so i think i should have multiple order to reach my desire for entering after the first buy or sell on daily open. i think about it, thanks man. :)

 
I answered the same question in MT4 forum...
Reason: