Can someone help me fix my EA trailing stop loss - page 2

 
JayB:

i have also changed by putting this Check trailing stop function under the OnTick like this.

It does not give me errors, but even if i remove the functions still no errors. 

the trailing stop is not showing any movements either.

thats my worry


when price moves 5000 points in profit i expect to see the trail stop going up 5000 but its not going up on my strategy tester

 
Vladimir Karputov:

Thank you. i had also passed through this article trying to understand how trail works.

But Are you saying the trailing stop is working despite not seeing movement when testing the EA on strategy tester mt5 Vladimir ?

 
JayB :

Thank you. i had also passed through this article trying to understand how trail works.

But Are you saying the trailing stop is working despite not seeing movement when testing the EA on strategy tester mt5 Vladimir ?

What does the tester have to do with it? I gave you a description and a blank - you need to change your code. You need to understand how trailing works. You need to understand that trailing takes into account several parameters: position open price, current position price, position type, current stop loss.

Just correct your code.

 
Vladimir Karputov:

What does the tester have to do with it? I gave you a description and a blank - you need to change your code. You need to understand how trailing works. You need to understand that trailing takes into account several parameters: position open price, current position price, position type, current stop loss.

Just correct your code.

I finally understood what you were saying. I was not paying enough attention, my worry was about only making it to work. 

Got some air, cleared my mind and revisited the Trail stop page. 


I managed to make some changes and restructure the code. Now the EA seems to not read my conditions of buy and sell.

i suspect it is how i structured.

take a look

Files:
 
JayB :

I finally understood what you were saying. I was not paying enough attention, my worry was about only making it to work. 

Got some air, cleared my mind and revisited the Trail stop page. 


I managed to make some changes and restructure the code. Now the EA seems to not read my conditions of buy and sell.

i suspect it is how i structured.

take a look

I combed my hair and corrected your code. I (temporarily) threw out trailing. Just study the code.

 version   "1.003"


Files:
 
Vladimir Karputov:

I combed my hair and corrected your code. I (temporarily) threw out trailing. Just study the code.

 version   "1.003"


😊😊Thank you very much. That's some great piece of smart work right there.

I just went through the whole code but now running the tests, its not executing positions. 

The error is invalid stops. Is it referring to sl, tp or both?


Since i will be trading indices, let me also know where to adjust when i want to switch to binary indices or currencies. 

I see you pretested using USDJPY there and there was no problem.

Stop loss i had planned 10000 points

Take profit is when price reaches level 70 overbought or 30 oversold (just an example)

But we can still make Take profit 20000 points (just an example)

 
JayB :

😊😊Thank you very much. That's some great piece of smart work right there.

I just went through the whole code but now running the tests, its not executing positions. 

The error is invalid stops. Is it referring to sl, tp or both?


Since i will be trading indices, let me also know where to adjust when i want to switch to binary indices or currencies. 

I see you pretested using USDJPY there and there was no problem.

Stop loss i had planned 10000 points

Take profit is when price reaches level 70 overbought or 30 oversold ( just an example)

But we can still make Take profit 20000 points (just an example)

version "1.004" - introduced normalization of Stop Loss and Take Profit. I saw that you want to work on binary options - if so, no longer contact me for help.

Files:
 
Vladimir Karputov:

version "1.004" - introduced normalization of Stop Loss and Take Profit. I saw that you want to work on binary options - if so, no longer contact me for help.

Thank you. 
I did not mean binary options sorry, i meant synthetic indices on binary.com. 
The likes of Volatility indices on mt5. 

The EA is still printing error [invalid stops] after normalization. 
Could it be that Trail stop, step, sl or tp is too close to the pricing with Trailing Stop
 
JayB :
***
I did not mean binary options sorry, i meant synthetic indices on binary.com. 
**

It is the same. Sorry, I don't help such thrill-seekers. Goodbye.

 
Vladimir Karputov:

It is the same. Sorry, I don't help such thrill-seekers. Goodbye.

I trade volatility indices for the reason being, there is a possibility of little or no manipulation than currencies by the broker. 
Its only that i discovered these indices have a tendency to respect price action without too much manipulation more than currencies Vladimir. 
Apologies if maybe i potrayed a behavior of a thrill seeker but more than just coding this strategy i am learning also how to programme MQL5 language for future's sake.
I want to be able to programme for currency pairs as well.. 
But it starts with understanding how coding works with a strategy that i understand better, which happens to trade volatility indices as for me. 

Otherwise i am this close to make this EA work.. please help me to make it work sir.