Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (OptimusPrime, AndrewAMD), 14,580 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Stop And Reverse #484799
12/10/21 17:49
12/10/21 17:49
Joined: Dec 2021
Posts: 7
O
Oliverlista Offline OP
Newbie
Oliverlista  Offline OP
Newbie
O

Joined: Dec 2021
Posts: 7
Hey guys.

This simple strategy buys when there are three consecutive higher closes and shorts when there are three consecutive lower closes.
Normally, it is a reversal system which covers long at a short signal and cover shorts vice versa.
So I decided to trail it with SAR on zorro but it doesnt seem to work because it still obeys the reversal system
The code needs something to prevent either longs or shorts when a position is open unless the SAR has stopped the position out.

Here is the code:



function run()

{


StartDate = 2002 ;
EndDate = 2021;
BarPeriod = 1440;
MaxLong = 1;
MaxShort = 1;
LookBack = 200;


vars Close = series(priceClose());
Stop = 2*ATR(100);
Trail = SAR(0.02,0.02,0.2);



if ( (Close[2]>Close[3]) and (Close[1]>Close[2]) and (Close[0]>Close[1]) )
enterLong();

if ( (Close[2]<Close[3]) and (Close[1]<Close[2]) and (Close[0]<Close[1]) )
enterShort();

set(PLOTNOW);
plot("SAR",SAR(0.02,0.02,0.2),DOT,BLUE);

}

Kindly give me the cheat code....

Re: Stop And Reverse [Re: Oliverlista] #484810
12/11/21 11:03
12/11/21 11:03
Joined: Apr 2008
Posts: 594
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 594
Austria
Trail with SAR? That makes not really sense to me, for trailing you normally use a price distance. SAR is no price distance but an indicator that alternates above or below the price line. Maybe you meant ATR?

Re: Stop And Reverse [Re: Oliverlista] #484816
12/11/21 17:01
12/11/21 17:01
Joined: Dec 2021
Posts: 7
O
Oliverlista Offline OP
Newbie
Oliverlista  Offline OP
Newbie
O

Joined: Dec 2021
Posts: 7
The SAR trail is as the dots alternates. SAR is a rather common trailing stop.
I know well about ATR trails and Chandeliers

Re: Stop And Reverse [Re: Oliverlista] #484820
12/12/21 12:21
12/12/21 12:21
Joined: Apr 2008
Posts: 594
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 594
Austria
You confused Trail and Stop. SAR is not for Trail. It is sometimes used to set the Stop.

To move the stop with the SAR, you can use a TMF.


Moderated by  Petra 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1