Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 559 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
closing profitable trades (stop) #475361
12/04/18 13:27
12/04/18 13:27
Joined: Apr 2018
Posts: 46
M
MINER Offline OP
Newbie
MINER  Offline OP
Newbie
M

Joined: Apr 2018
Posts: 46
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.

Re: closing profitable trades (stop) [Re: MINER] #475363
12/04/18 13:55
12/04/18 13:55
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
Post your script.

Re: closing profitable trades (stop) [Re: AndrewAMD] #475364
12/04/18 14:10
12/04/18 14:10
Joined: Apr 2018
Posts: 46
M
MINER Offline OP
Newbie
MINER  Offline OP
Newbie
M

Joined: Apr 2018
Posts: 46
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;
}

Re: closing profitable trades (stop) [Re: MINER] #475367
12/04/18 14:42
12/04/18 14:42
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
The entire script, please. You left out the TMF's, which are critical.

Re: closing profitable trades (stop) [Re: AndrewAMD] #475455
12/11/18 11:47
12/11/18 11:47
Joined: Apr 2018
Posts: 46
M
MINER Offline OP
Newbie
MINER  Offline OP
Newbie
M

Joined: Apr 2018
Posts: 46
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;
}


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1