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 (AndrewAMD), 945 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Page 1 of 2 1 2
Risk Variable #479157
02/25/20 20:20
02/25/20 20:20
Joined: Jan 2020
Posts: 32
L
leohermoso Offline OP
Newbie
leohermoso  Offline OP
Newbie
L

Joined: Jan 2020
Posts: 32
Hello, friends!


How is this possible?
Code
				Stop = range->High;
				Entry = range->Low;
				Risk = 50;
				
				enterShort(TrailMorningRange, Trigger);


Code
Name	Type	Asset	ID	Lots	Open	Close	Entry	Exit	Profit	Roll	ExitType
Robel:MorningRange	Long	USDCHF	1029103	380	12/09/2019 11:52	12/09/2019 12:30	0,993418	0,991346	-834	0	Stop
Robel:MorningRange	Short	USDCHF	1115602	380	26/11/2019 13:31	26/11/2019 16:00	0,996612	0,998263	-670	0	Stop
Robel:MorningRange	Long	AUDJPY	1115507	449	26/11/2019 09:06	26/11/2019 09:06	73,96	73,84	-531	0	Stop
Robel:MorningRange	Long	USDJPY	1029403	293	12/09/2019 14:12	12/09/2019 14:23	108,11	107,92	-528	0	Stop
Robel:MorningRange	Short	NZDJPY	970503	420	08/08/2019 10:55	08/08/2019 13:03	68,45	68,58	-501	0	Stop
Robel:MorningRange	Long	AUDJPY	1029401	147	12/09/2019 14:11	12/09/2019 14:11	74,41	74,07	-464	0	Stop
Robel:MorningRange	Long	AUDJPY	984404	301	16/08/2019 08:35	16/08/2019 14:10	72,12	71,97	-429	0	Stop
Robel:MorningRange	Short	AUDJPY	1100801	301	30/10/2019 11:55	30/10/2019 15:58	74,7	74,84	-408	0	Stop
Robel:MorningRange	Long	USDJPY	1131102	205	06/12/2019 13:31	06/12/2019 13:31	108,77	108,56	-405	0	Stop
Robel:MorningRange	Short	USDCHF	1116305	308	27/11/2019 08:50	27/11/2019 13:33	0,99769	0,998896	-402	0	Stop
Robel:MorningRange	Short	GBPUSD	1102308	208	01/11/2019 09:15	01/11/2019 14:01	1,2953	1,2971	-394	0	Stop
Robel:MorningRange	Long	NZDJPY	1115601	390	26/11/2019 13:04	26/11/2019 14:46	70,02	69,92	-375	0	Stop
Robel:MorningRange	Short	GBPUSD	1078008	62	11/10/2019 08:45	11/10/2019 08:45	1,24432	1,24987	-350	0	Stop
Robel:MorningRange	Short	USDJPY	1111801	373	19/11/2019 15:05	19/11/2019 16:39	108,57	108,66	-344	0	Stop
Robel:MorningRange	Long	USDCHF	1100802	182	30/10/2019 12:37	30/10/2019 13:41	0,994034	0,992274	-341	0	Stop
Robel:MorningRange	Long	GBPUSD	1175102	131	07/01/2020 08:01	07/01/2020 10:01	1,31707	1,31462	-333	0	Stop
Robel:MorningRange	Long	GBPJPY	1175101	62	07/01/2020 08:01	07/01/2020 12:01	142,89	142,33	-327	0	Stop
Robel:MorningRange	Short	USDCHF	1059701	122	01/10/2019 14:01	01/10/2019 14:01	0,998524	1,00104	-324	0	Stop
Robel:MorningRange	Short	USDJPY	1116309	469	27/11/2019 10:34	27/11/2019 13:21	109,14	109,21	-318	0	Stop
Robel:MorningRange	Long	USDJPY	1102310	349	01/11/2019 09:31	01/11/2019 12:19	108,06	107,96	-316	0	Stop




The Risk variable is being completely ignored. This is in test mode.

Can someone put some light on it?

Edit 1:

I set LotLimit = 100 and get this

Code
Name	                        Type	Asset	     ID	Lots	Open	                 Close              	Entry	Exit   	Profit	Roll	ExitType

Robel:MorningRange	Long	USDJPY	1098602	607	25/10/2019 15:26	25/10/2019 17:00	108,69	108,75	350	0	Sold
Robel:MorningRange	Short	USDJPY	1116309	496	27/11/2019 10:34	27/11/2019 13:21	109,14	109,21	-333	0	Stop
Robel:MorningRange	Short	USDJPY	1111801	390	19/11/2019 15:05	19/11/2019 16:39	108,56	108,66	-357	0	Stop
Robel:MorningRange	Long	USDJPY	1102310	364	01/11/2019 09:31	01/11/2019 12:19	108,06	107,96	-327	0	Stop
Robel:MorningRange	Long	GBPUSD	1160601	312	26/12/2019 15:46	26/12/2019 16:00	1,29993	1,30003	31,19	0	Sold
Robel:MorningRange	Long	USDJPY	1029403	303	12/09/2019 14:12	12/09/2019 14:23	108,11	107,91	-544	0	Stop
Robel:MorningRange	Long	AUDJPY	1115507	303	26/11/2019 09:06	26/11/2019 09:06	73,96	73,83	-375	0	Stop
Robel:MorningRange	Short	AUDJPY	1135108	303	10/12/2019 08:53	10/12/2019 16:00	74,08	74,02	167	0	Sold
Robel:MorningRange	Long	USDJPY	1117202	287	28/11/2019 12:03	28/11/2019 17:00	109,5	109,53	95,3	0	Sold
Robel:MorningRange	Short	USDJPY	1128901	287	05/12/2019 15:12	05/12/2019 16:00	108,77	108,76	23,65	0	Sold
Robel:MorningRange	Long	USDJPY	1078101	273	11/10/2019 09:30	11/10/2019 16:00	108,05	108,5	1123	0	Sold
Robel:MorningRange	Short	USDJPY	1087601	273	17/10/2019 11:06	17/10/2019 16:00	108,69	108,52	409	0	Sold
Robel:MorningRange	Long	AUDJPY	1121003	273	02/12/2019 08:16	02/12/2019 16:00	74,3	74,34	91,49	0	Sold
Robel:MorningRange	Long	USDCHF	1125905	256	04/12/2019 09:11	04/12/2019 16:00	0,987664	0,988706	274	0	Sold




And this is the Assetlist entry for USDCHF, one of the assets with wrong lots


USDCHF 0,97289 0,00019 4,56 -8,18 0,0001 0,102787 0 500 1000 0 USDCHF



Some trades were skipped but some were taken.





Attached Files Errorlots.PNG
Last edited by Leohermoso; 02/25/20 21:48.
Re: Risk Variable [Re: leohermoso] #479165
02/25/20 22:49
02/25/20 22:49
Joined: Mar 2019
Posts: 357
D
danatrader Offline
Senior Member
danatrader  Offline
Senior Member
D

Joined: Mar 2019
Posts: 357
When Margin is not set, the trade size is only limited by Risk; this can lead to extreme trade sizes

Last edited by danatrader; 02/25/20 22:49.
Re: Risk Variable [Re: danatrader] #479166
02/25/20 22:55
02/25/20 22:55
Joined: Jan 2020
Posts: 32
L
leohermoso Offline OP
Newbie
leohermoso  Offline OP
Newbie
L

Joined: Jan 2020
Posts: 32
I see that! But none of the trades had extreme sizes. The biggest one had 607 Lots, that is 6.07 regular lots, there is plenty of liquidity to fill an order like that.

Re: Risk Variable [Re: leohermoso] #479167
02/25/20 22:59
02/25/20 22:59
Joined: Mar 2019
Posts: 357
D
danatrader Offline
Senior Member
danatrader  Offline
Senior Member
D

Joined: Mar 2019
Posts: 357
I assume it is not about liquidity, it is about what the algo knows, you set 100 lots, 600 is extreme.

Re: Risk Variable [Re: leohermoso] #479168
02/25/20 23:09
02/25/20 23:09
Joined: Jan 2020
Posts: 32
L
leohermoso Offline OP
Newbie
leohermoso  Offline OP
Newbie
L

Joined: Jan 2020
Posts: 32
In fact, is about liquidity. One of the causes of slippage is low liquidity and big order. 6 Standard Lots are not extreme.

Also, the 600 lot size should not have been opened, as I had set a LotLimit of 100.

Re: Risk Variable [Re: leohermoso] #479176
02/26/20 14:37
02/26/20 14:37
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Correct. The conclusion is that you failed to set a LotLimit of 100. Find out why, then fix it. Suggestions: https://manual.zorro-project.com/trouble.htm. Read especially the remarks about clean code and order of statements.

BTW, LotLimit is not meant for setting the trade size. Use Lots, Margin, or Risk for that.

Re: Risk Variable [Re: leohermoso] #479223
03/04/20 00:34
03/04/20 00:34
Joined: Jan 2020
Posts: 32
L
leohermoso Offline OP
Newbie
leohermoso  Offline OP
Newbie
L

Joined: Jan 2020
Posts: 32
Hello jcl, tks for replying! I completely understand that LotLimit is not meant for lot setting, my point doing this is to show that even with lotlimit set to 100, I get trades with lots greater than 100. If you look at the top of my question you will see that the initial arguing was about setting Risk = 50 and get trades with stop loss much greater than 50.

Its a little bit hard to fail to set LotLimit = 100;

I cant figure this out. I can understand how this
Code
			asset("AUDUSD");
			Stop = range->Low;
			Entry = range->High;
			Risk = 100;
			enterLong();


Can yield this:

Code
Name	Type	Asset	ID	Lots	Open	Close	Entry	Exit	Profit	Roll	ExitType
Robel:MorningRange	Short	AUDUSD	480101	278	16/10/2019 10:49	16/10/2019 15:01	0,67304	0,674773	-501	0	Stop

Re: Risk Variable [Re: leohermoso] #479227
03/04/20 08:22
03/04/20 08:22
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Even when it's hard to fail, apparently people manage it all the time. But without knowing the mistake I can only give general advices here. If you can't fix it yourself, get a support ticket, show them your script, and let them help. This will quickly solve the problem.

Re: Risk Variable [Re: leohermoso] #479235
03/07/20 17:05
03/07/20 17:05
Joined: Jan 2020
Posts: 32
L
leohermoso Offline OP
Newbie
leohermoso  Offline OP
Newbie
L

Joined: Jan 2020
Posts: 32
Tks again jcl. I don't think support will help with my script. This was the answer of the last iteration I had with them

"Hi Leo,



sorry, we cannot do that – we're explicitly prohibited by company policy to debug user scripts. Unless the issue is a Zorro bug,"



I appreciate your help jcl! I will keep looking to solve this problem.

Best regards.

Re: Risk Variable [Re: leohermoso] #479898
05/03/20 23:38
05/03/20 23:38
Joined: Mar 2019
Posts: 357
D
danatrader Offline
Senior Member
danatrader  Offline
Senior Member
D

Joined: Mar 2019
Posts: 357
Use Lots = Max(100, blabla); wheras you calculate your lotsize in the second part, but limit it to the max of 100.

Page 1 of 2 1 2

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1