You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
You should read better the formula I gave you, you didn't apply it correctly.
Should be :
You should read better the formula I gave you, you didn't apply it correctly.
Should be :
oops. sorry.
what about tv. i have TICK_VALUE_LOSS
but should it be just TICK_VALUE?
oops. sorry.
what about tv. i have TICK_VALUE_LOSS
but should it be just TICK_VALUE?
It's a complicated matter. See an extended discussion here : https://www.mql5.com/en/forum/441959
My suggestion is to stay simple and just use TICK_VALUE.
It's a complicated matter. See an extended discussion here : https://www.mql5.com/en/forum/441959
My suggestion is to stay simple and just use TICK_VALUE.
thanks -- ever so much!
...yeah thats why i asked. i had read that thread and couple other with arguements both for and against using loss/profit or just value.
threads like that make the issues less clear than the original question seemed. exactly when the saying "clear as mud" is for.
thanks again. off to bed now.
my code has worked now for a full week, and i added to the code -- to remove the swap fee from the initial 350 before converting that result into points. I also made it to "refresh" the sl every day at 01:00 when swap fees have been updated.
i know it is working because i have had 1 trade hit sl on at least half of my fx pairs on my broker, all within 15 cents of the $350.
The script derives the new SL from position.PriceOpen(), not the current Bid or Ask. That works fine right when a position opens. Once price has moved a meaningful distance from that entry, the same reference point can put the calculated SL on the wrong side of the current market, and MT5 rejects it as invalid stops.
not sure what you mean. i have been using it daily, hourly -- since my prev msg and i have not seen any "Invalid Stops" errors. This is probably because i have my sl 70 - 140% of the tradesize. The only small issue i have is with jpy pairs, the sl can be $15 from my intended dollar sl. All other pairs are within cents of my intended dollar sl.
EDIT: maybe the spread should be added to the calc, as you sugggested. @Alain Verleyen ?
EDIT: maybe the spread should be added to the calc, as you sugggested. @Alain Verleyen ?
The script derives the new SL from position.PriceOpen(), not the current Bid or Ask. That works fine right when a position opens. Once price has moved a meaningful distance from that entry, the same reference point can put the calculated SL on the wrong side of the current market, and MT5 rejects it as invalid stops.
Note that after i saw your msg i went back to see my code, and found i already had added swaps into the math. See following code. If anyone has any criticism or advice or suggestions for improvement, please make them below.
I call this function at end of M5 candle -- if a trade has opened. I also clear my sl 6 minutes before 0 hour and then call the function 6 minutes after 01:00 to recalculate with new swaps, and to replace the sl(s).
also note that i am using these at Global Enviro
CTrade trade; CPositionInfo position; trade.SetAsyncMode(true);@Alain Verleyen @Vinicius Pereira De Oliveira @Vladislav Boyko @Ryan L Johnson @Gerard William G J B M Dinh Sy
My "$ value to sl" function. working with no noticed Invalid stop errors or any other errors noticed.