Posted By: Neb
Trade management functions ( TMF ) - 12/22/20 14:55
Hi,
I have a few issue with using TMF to set/change my stop losses or trail my profit.
1)
When I am using TMF to setup and move my SL, it is not setting up SL at all ?
int myTMF()
{
for(open_trades) {
if(TradeIsLong && TradeProfit>0) TradeStopLimit = max(TradeStopLimit, priceClose()-4*ATR(40));
else if(TradeIsShort && TradeProfit>0) TradeStopLimit = min(TradeStopLimit, priceClose()+4*ATR(40));
if(TradeStopLimit != 0) plot("Stop",TradeStopLimit,DOT|MAIN,BLUE);
}
return 0;
}
Picture attached.
2) As I found out, I can't use distance in TMF to set it up ?
This won't work ->
TradeStopLimit = 50*PIP;
It set my stop basically to the price value of 50, as my test shows.
3)
TradeStopLimit = priceClose()-4*ATR(40));
I found this to work, but problem is that it is going up and down and in long trade I want it to go only up or not to change once it has been setup.
4)
How I can setup trail, as it said I can't setup with distance in PIP.
How actually I am setting it up, if I want to use different TradeTrailLock, according to the level of profit ?
if (TradeProfit >0)
{
TradeTrailLock = 0.2
}
if (TradeProfit >0.05*Balance)
{
TradeTrailLock = 0.8
}
I am not great in programming, just learning, sorry
Thanks in advance !!
Neb