Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (degenerate_762), 1,114 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 20 1 2 3 4 5 19 20
Re: One Night Stand System [Re: RTG] #454844
09/25/15 01:32
09/25/15 01:32
Joined: Feb 2014
Posts: 181
R
RTG Offline OP
Member
RTG  Offline OP
Member
R

Joined: Feb 2014
Posts: 181
It looks like the script has stopped worki. Pending trades do not setup as previously on a Friday.

Anyone know why this would be the case?

Last edited by RTG; 09/25/15 14:18.
Re: One Night Stand System [Re: RTG] #455063
10/06/15 03:12
10/06/15 03:12
Joined: Feb 2014
Posts: 181
R
RTG Offline OP
Member
RTG  Offline OP
Member
R

Joined: Feb 2014
Posts: 181
One thing I would like to change is the Margin for the asset "USOil" only.

I would like to reduce it by a factor of about the current oil price in USD, which is about 45.

I have tried the following which seems to reduce the margin for all assets by a factor of 45. This seems to have the effect of reducing all position sizes by a factor of 45, not just the oil asset.

Capital = 50000;
if(asset("USOil")){
Margin = 0.01 * (Capital + (WinTotal-LossTotal))/45; }
else {
Margin = 0.01 * (Capital + (WinTotal-LossTotal));}

Re: One Night Stand System [Re: RTG] #455066
10/06/15 10:36
10/06/15 10:36
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline
User
MatPed  Offline
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
Hi RTG, once Margin have been reduced the first time for USOil, it will be reduced for the all the next assets. Store the Margin in a var and restore to the proper value in the else statement.

Ciao

Re: One Night Stand System [Re: MatPed] #455070
10/06/15 15:25
10/06/15 15:25
Joined: Feb 2014
Posts: 181
R
RTG Offline OP
Member
RTG  Offline OP
Member
R

Joined: Feb 2014
Posts: 181
HI. I am not quite sure what you mean right now but I will sleep on it.

Re: One Night Stand System [Re: RTG] #455072
10/06/15 15:32
10/06/15 15:32
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline
Serious User
DdlV  Offline
Serious User
D

Joined: Jun 2013
Posts: 1,609
Hi RTG. asset(string) is a function that changes asset. Asset is the current asset. Do you want instead something like if(Asset=="USOil")?

HTH.

Re: One Night Stand System [Re: DdlV] #455073
10/07/15 02:30
10/07/15 02:30
Joined: Feb 2014
Posts: 181
R
RTG Offline OP
Member
RTG  Offline OP
Member
R

Joined: Feb 2014
Posts: 181
Still not working for me.

Is the issue that Margin is being set twice, and the run function can only use one value?

Re: One Night Stand System [Re: RTG] #455085
10/08/15 03:40
10/08/15 03:40
Joined: Feb 2014
Posts: 181
R
RTG Offline OP
Member
RTG  Offline OP
Member
R

Joined: Feb 2014
Posts: 181
Got it to work by splitting Oil off into its own function with its own margin and then bringing it back in the run function.

Re: One Night Stand System [Re: RTG] #455118
10/10/15 13:24
10/10/15 13:24
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline
User
Sphin  Offline
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
Quote:
As yet I haven't worked out why the script stopped setting up the pending entry stop levels on Friday

This is from a Z-Systems-Thread but I think it is related to the system discussed in here.

1. What code of the system in detail you are trading live?
2. "Stopped setting up entry stop levels" means that Zorro does not open trades at a certain level but as market orders or how does Zorro behave?
3. What Zorro version do you use and did you change it during trading?

Re: One Night Stand System [Re: Sphin] #455139
10/10/15 23:36
10/10/15 23:36
Joined: Feb 2014
Posts: 181
R
RTG Offline OP
Member
RTG  Offline OP
Member
R

Joined: Feb 2014
Posts: 181
1. I will paste the code at the bottom of this post.

2. Zorro used to setup the entry stop levels every Friday as one would expect.
Ie the console would display something like “USD/CHF entry long stop @ 1.05” and do this for all assets at 12am Friday UTC time. From there it would wait until price crossed these thresholds, then it would enter (or not if price didn’t cross the threshold).

Since the crash and installation of version 1.34, it will not do this unless a smaller bar period is used. It works on bar periods from 1 minute to 720 minutes but not at 1440 minutes (which is what the trading system requires).

3. It was working under the previous Zorro version which was 1.32 I believe. After the vps crash I upgraded to 1.34. I can't say if the issue is connected to 1.34.

Here is the code I tried on Friday using 30 minute bars in an attempt to get it to setup properly once again.

include <profile.c>

function tradeOneNightStand() {
TimeFrame = 48;
vars Price = series(price());
vars SMA10 = series(SMA(Price, 10));
vars SMA40 = series(SMA(Price, 40));

set(PARAMETERS+FACTORS);

Margin = 0.02 * (Capital + WinTotal-LossTotal);

//Stop = 150 * PIP;

var BuyStop,SellStop;

BuyStop = HH(10) + 1*PIP;
SellStop = LL(10) - 1*PIP;

if (dow() == 5 && NumOpenLong == 0 && NumPendingLong == 0 && SMA10[0] > SMA40[0])
enterLong(0,BuyStop);
else if (dow() == 5 && NumOpenShort == 0 && NumPendingShort == 0 && SMA10[0] < SMA40[0])
enterShort(0,SellStop);

if (dow() != 5 && dow() != 6 && dow() != 7){
exitLong();
exitShort();

}
}
//split oil asset from currencies because of outsized positions
function tradeOil(){
TimeFrame = 48;
asset("USOil");
vars Price = series(price());
vars SMA10 = series(SMA(Price, 10));
vars SMA40 = series(SMA(Price, 40));

set(PARAMETERS+FACTORS);

Margin = 0.005 * (Capital + WinTotal-LossTotal);

//Stop = 150 * PIP;

var BuyStop,SellStop;

BuyStop = HH(10) + 1*PIP;
SellStop = LL(10) - 1*PIP;

if (dow() == 5 && NumOpenLong == 0 && NumPendingLong == 0 && SMA10[0] > SMA40[0])
enterLong(0,BuyStop);
else if (dow() == 5 && NumOpenShort == 0 && NumPendingShort == 0 && SMA10[0] < SMA40[0])
enterShort(0,SellStop);

if (dow() != 5 && dow() != 6 && dow() != 7 ){
exitLong();
exitShort();}
}

function run() {

LookBack = 40*48;
Verbose = 14;
BarPeriod = 30;
StartDate = 2005;
Capital = 50000;
// NumWFOCycles = 3;

// method 2: invest the square root of the total profit
// Margin = OptimalF * Capital * sqrt(1 + max(0,WinTotal-LossTotal)/Capital);

//while(asset(loop("AUD/CAD","USD/SEK","USD/JPY","USD/HKD","USD/CNH","USD/CHF","USD/CAD","NZD/USD","NZD/JPY","GBP/USD",
//"GBP/NZD","GBP/JPY","GBP/CHF","GBP/CAD","GBP/AUD","EUR/USD","EUR/JPY","EUR/GBP","EUR/CHF","EUR/CAD",
//"EUR/AUD","CHF/JPY","CAD/JPY","AUD/USD","AUD/NZD","AUD/JPY")))

while(asset(loop("USD/CHF","USD/JPY","GBP/USD","EUR/USD","EUR/JPY","USD/CAD")))
{
tradeOneNightStand();
}
tradeOil();

//ColorUp = 0;
//ColorDn = 0;
//ColorEquity = 0;
//plotTradeProfile(20);
//plotMAEGraph(-1);
//plotPriceProfile(10,0);
//plotQuarterProfit();
//plotMonthProfit();
plotMonthProfit();
}

Re: One Night Stand System [Re: RTG] #455149
10/11/15 12:02
10/11/15 12:02
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline
User
Sphin  Offline
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
"set" can be used in a single function? Nice, I thought it could be used in the run() and once only.

In my Zorro (1.36.4 - and the .4 meanwhile is important because each version shows, if only slightly but different results) setting BarPeriod to 1440 (and omit TimeFrame of course) works and let the strategy doing as expected. Involving LOGFILE flag shows trades like:

Code:
[42: Fri 04.03.05 00:00]  1.3137-1.3166-1.3098-1.3114
(USD/CHF::S) Short 20@1.1571 Entry stop
(USD/JPY::L) Long 100@105.91 Entry stop
(GBP/USD::L) Long 71@1.9266 Entry stop
(EUR/USD::L) Long 100@1.3282 Entry stop
(GBP/USD::L) Entry stop 1.9266 hit at 00:00
[GBP/USD::L4314] Long 71@1.9266  at 00:00

[43: Mon 07.03.05 00:00]  1.30880-1.32560  +0 -161 0/1

Monday 07.03.05  Loss -161$ ----
(USD/CHF::S) Missed entry 1.1571 at exit command
(USD/JPY::L) Missed entry 105.91 at exit command
[GBP/USD::L4314] Sell 71@1.9241: -161$ at 00:00
(EUR/USD::L) Missed entry 1.3282 at exit command



There are only trades in assets that are known to AssetsFix.dta, the default one (that I use) therefore trades only these 4 assets in the log.

Using a TimeFrame has 2 important impacts here to the trades, first it does not use 00:00 for the entry stops but any time I guess maybe resulting from the time of starting the strategy and shifted 48 times in the future or similar, and the second one is more important: TimeFrame keeps EntryTime untouched, so the entry stops are only valid for the time of the BarPeriod, here: 30 minutes. These facts are also revealed by the log:

Code:
[7440: Fri 12.08.05 04:00]  1.2464-1.2465-1.2461-1.2464
(USD/CHF::S) Short 20@1.2451 Entry stop
(USD/JPY::L) Long 100@112.81 Entry stop
(GBP/USD::L) Long 71@1.8140 Entry stop
(EUR/USD::L) Long 100@1.2479 Entry stop

[7441: Fri 12.08.05 04:30]  1.24580-1.24680  +0 +0 0/0
(USD/CHF::S) Missed entry 1.2451 after 1 bar
(USD/JPY::L) Missed entry 112.81 after 1 bar
(GBP/USD::L) Missed entry 1.8140 after 1 bar
(EUR/USD::L) Missed entry 1.2479 after 1 bar



To avoid this I guess you can synchronise the TimeFrame with frameSync() and increase the EntryTime accordingly. But I think it's really easier to use BarPeriod = 1440.

Page 3 of 20 1 2 3 4 5 19 20

Moderated by  Petra 

Gamestudio download | chip programmers | 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