closing profitable trades (stop)

Posted By: MINER

closing profitable trades (stop) - 12/04/18 13:27

Hello Community,

My Zorro is closing trades which are in profit and the reason for this is a Stop, Zorro is indicating that the trade was closed at a loss but the trade is profitable on mt4. How can i sort this out such that Zorro does not trigger closing profitable trades by Stop but continue the trade since its in favorable direction.
Posted By: AndrewAMD

Re: closing profitable trades (stop) - 12/04/18 13:55

Post your script.
Posted By: MINER

Re: closing profitable trades (stop) - 12/04/18 14:10

The Code is as below AndrewAMD...

function run()
{
StartDate = 2011;
EndDate = 2018;
set(TICKS);
//Lots = 100;
BarPeriod = 60;
LookBack = 150;
MaxLong = 1;
MaxShort = 1;

//Stop = 50*PIP;
//Trail = 40*PIP;
//TrailLock = 1;

//vars Low = series(priceLow());
//vars high = series(priceHigh());
vars Close = series(priceClose());
vars EMA7 = series(EMA(Close, 7));

if(Close[0] > EMA7[0])
enterLong(TrailingStopLong);


if(Close[0] < EMA7[0])
enterShort(TrailingStopShort);


plot("EMA7", EMA7[0], 0, BLUE);

set(PLOTNOW);
PlotWidth = 1200;
PlotHeight1 = 350;
}
Posted By: AndrewAMD

Re: closing profitable trades (stop) - 12/04/18 14:42

The entire script, please. You left out the TMF's, which are critical.
Posted By: MINER

Re: closing profitable trades (stop) - 12/11/18 11:47

int TrailingStopLong()
{
//adjust the stop only when the trade is in profit
if(TradeIsOpen and TradeProfit > 0) //////TradeStopLimit = max(TradeStopLimit,LL(3));
//place the stop at 40 points from current price//bars
TradeStopLimit = max(TradeStopLimit, LL(4));
//plot a line to make the stop limit visible
plot("stop", TradeStopLimit, MINV, BLACK);
//RETURN 0 FOR CHECKING THE LIMITS
return 0;
}


int TrailingStopShort()
{
//adjust the stop only when the trade is in profit
if(TradeIsOpen and TradeProfit > 0)
//place the stop at 40 points from current price//bars
TradeStopLimit = max(TradeStopLimit, HH(4));
//plot a line to make the stop limit visible
plot("stop", TradeStopLimit, MINV, BLACK);
//RETURN 0 FOR CHECKING THE LIMITS
return 0;
}
© 2024 lite-C Forums