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
7 registered members (EternallyCurious, 7th_zorro, Ayumi, Quad, AndrewAMD, ricky_k, 1 invisible), 497 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
Trailing Stops and Stops in Zorro #463204
11/21/16 15:09
11/21/16 15:09
Joined: Nov 2016
Posts: 35
therealLeon Offline OP
Newbie
therealLeon  Offline OP
Newbie

Joined: Nov 2016
Posts: 35
Hello,

i'm not sure how trailing stops and stops are going together in zorro.

Is a Stop calculated each time a new Bar appears for example an ATR Stop. Because the ATR is changing?

How does the Initial Stop correlates with the Trailing Stop?

BR

Leon

Re: Trailing Stops and Stops in Zorro [Re: therealLeon] #463332
11/28/16 15:25
11/28/16 15:25
Joined: Nov 2016
Posts: 35
therealLeon Offline OP
Newbie
therealLeon  Offline OP
Newbie

Joined: Nov 2016
Posts: 35
Hello,

to show exactly what i mean i made some tests.
I build a system which is making only one trade.
This trade is made in a positive market situation for better understanding.
I made a Stop and a trailing stop.
2 modifications of the code are running - the first one with stop (asset is DAX) at 148, the second mod at 200. The trailing stop is at BOTH the same: 50 points.

Normally the stop and the trailing stop should not interact with each other. But this is happening in the test. Both systems are using the trailing stop diffently even if in code it is set to the same: 50 points... .

Here some data:
Code:
bool onetrade = true;

function run()
{
    StartDate = 20160803;
    EndDate = 20160818;
    BarPeriod=1440;
    PlotScale=20;
    
    set(LOGFILE);
    asset("GER30");
    
    
    bool traded = false;
    
    for(open_trades)    // Verify if we're on market
    {
        if(TradeIsOpen)
        {
            traded = true;
            onetrade = false;
        }
    }
    
    if(!traded && onetrade)
        enterLong (0,10200,148,0,50);


The other modification runs the same despite stop at 200:
enterLong (0,10200,148,0,50);

Results are:
for Stop at 148:

Code:
[273: Wed 03.08.16 00:00] (10302.48)
(GER30::L) Long 1@10200.00 Entry stop
(GER30::L) Entry stop 10200.00 hit at 00:00:00
[GER30::L7401] Long 1@10201.19 Risk 15$ t at 00:00:00

[274: Thu 04.08.16 00:00] +0 +1 1/0  (10135.52)
[GER30::L7401] Trail 1@10201.19 Stop 10085.60 at 00:00:00

[275: Fri 05.08.16 00:00] +0 +3 1/0  (10242.02)
[GER30::L7401] Trail 1@10201.19 Stop 10176.50 at 00:00:00

[276: Mon 08.08.16 00:00] +0 +16 1/0  (10245.38)
[GER30::L7401] Trail 1@10201.19 Stop 10281.95 at 00:00:00

[277: Tue 09.08.16 00:00] +0 +23 1/0  (10403.58)
[GER30::L7401] Trail 1@10201.19 Stop 10413.05 at 00:00:00

[278: Wed 10.08.16 00:00] +0 +47 1/0  (10423.05)
[GER30::L7401] Trail 1@10201.19 Stop 10512.95 at 00:00:00

[279: Thu 11.08.16 00:00] +0 +44 1/0  (10687.58)
[GER30::L7401] Trail 1@10201.19 Stop 10544.55 at 00:00:00

[280: Fri 12.08.16 00:00] +0 +53 1/0  (10661.95)
[281: Mon 15.08.16 00:00] +0 +50 1/0  (10728.15)
[GER30::L7401] Trail 1@10201.19 Stop 10609.15 at 00:00:00

[282: Tue 16.08.16 00:00] +0 +53 1/0  (10722.45)
[283: Wed 17.08.16 00:00] +0 +46 1/0  (10712.25)
[GER30::L7401] Stop 1@10609.44: +40.60 at 00:00:00



for stop at 200:

Code:
[273: Wed 03.08.16 00:00] (10302.48)
(GER30::L) Long 1@10200.00 Entry stop
(GER30::L) Entry stop 10200.00 hit at 00:00:00
[GER30::L7401] Long 1@10201.19 Risk 20$ t at 00:00:00

[274: Thu 04.08.16 00:00] +0 +1 1/0  (10135.52)
[GER30::L7401] Trail 1@10201.19 Stop 10033.60 at 00:00:00

[275: Fri 05.08.16 00:00] +0 +3 1/0  (10242.02)
[GER30::L7401] Trail 1@10201.19 Stop 10124.50 at 00:00:00

[276: Mon 08.08.16 00:00] +0 +16 1/0  (10245.38)
[GER30::L7401] Trail 1@10201.19 Stop 10229.95 at 00:00:00

[277: Tue 09.08.16 00:00] +0 +23 1/0  (10403.58)
[GER30::L7401] Trail 1@10201.19 Stop 10413.05 at 00:00:00

[278: Wed 10.08.16 00:00] +0 +47 1/0  (10423.05)
[GER30::L7401] Trail 1@10201.19 Stop 10460.95 at 00:00:00

[279: Thu 11.08.16 00:00] +0 +44 1/0  (10687.58)
[GER30::L7401] Trail 1@10201.19 Stop 10492.55 at 00:00:00

[280: Fri 12.08.16 00:00] +0 +53 1/0  (10661.95)
[281: Mon 15.08.16 00:00] +0 +50 1/0  (10728.15)
[GER30::L7401] Trail 1@10201.19 Stop 10557.15 at 00:00:00

[282: Tue 16.08.16 00:00] +0 +53 1/0  (10722.45)
[283: Wed 17.08.16 00:00] +0 +46 1/0  (10712.25)
[GER30::L7401] Stop 1@10557.44: +35.40 at 00:00:00



It shows that the trailing stop is handled differently even if the trailing stop in the code is set to the same.

Can somebody tell me why the trailing stop is handled differently?

Attached Files Example.png
Re: Trailing Stops and Stops in Zorro [Re: therealLeon] #463384
12/01/16 12:11
12/01/16 12:11
Joined: Nov 2016
Posts: 35
therealLeon Offline OP
Newbie
therealLeon  Offline OP
Newbie

Joined: Nov 2016
Posts: 35
I found a solution by myself. In case somebody else is wondering:

Trailing Stop and Stop is a sum in Zorro as Trail.

For example: Your Stop is 8 your Trailing Stop is 2 - the Trailing will follow the price curve in a distance of 10.

Re: Trailing Stops and Stops in Zorro [Re: therealLeon] #475828
01/09/19 08:58
01/09/19 08:58
Joined: Apr 2018
Posts: 46
M
MINER Offline
Newbie
MINER  Offline
Newbie
M

Joined: Apr 2018
Posts: 46
Thank you Leon, i was experiencing the same problem but you have clarified it now.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1