Stop is set but enterLong() sets a very different stop level

Posted By: jari

Stop is set but enterLong() sets a very different stop level - 11/07/22 15:12

I did this in run():
Code
#define INFINITY_SUBST 1000

function run() {
	.
	.
	.
	Margin = slider(1,2000,100,10000,"Margin Allocated");
	Stop = price(0) / INFINITY_SUBST;
	Risk = Margin / 200.0;
}


When I did a print of Stop and then do enterLong(), log says:
Code
Stop 0.00000002

[xxxxxx::L00101] Long x@0.000019520 Risk 0  at xx:xx:xx
Stop 0.000019500


Why is the 0.00000002 Stop not honoured when enterLong happens?
(basically I want the stop to be practically 0 and let Risk determine the lot size)

Thank you!!
Posted By: Petra

Re: Stop is set but enterLong() sets a very different stop level - 11/08/22 09:51

Your 0.00000002 is a stop distance, not a stop level.

https://zorro-project.com/manual/en/stop.htm
Posted By: jari

Re: Stop is set but enterLong() sets a very different stop level - 11/08/22 13:34

Hmm just realised that, for Stop, "If the value is less than half the asset price, Zorro assumes that it's a distance, otherwise it's a price level"
i.e. the stop level can't be more than half of asset price

Ref: https://zorro-project.com/manual/en/stop.htm
© 2024 lite-C Forums