I am looking for code for two different inputs within the same system.
The first entry is under conditions a and b and positionsize normal.
The second entry is under conditions a, b, and c and positionsize/2.
They are not cumulative positions, or he enters with the first entry or with the second entry.
Thanks.
JSParticipant
Senior
Hi @jhon,
Something like this…
DefParam CumulateOrders = False
IF NOT OnMarket AND a and b THEN
BUY PositionSize Contracts AT MARKET
ENDIF
If Not OnMarket AND a and b and c THEN
BUY PositionSize/2 Contracts AT MARKET
ENDIF
Something like this
IF NOT OnMarket AND a and b THEN
BUY PositionSize Contracts AT MARKET
ENDIF
If Not OnMarket AND a and b and c THEN
BUY PositionSize/2 Contracts AT MARKET
ENDIF
Nah, not really. That may end up with 1.5x PositionSize because it is ambiguous (but we should try it for real in order to be sure); I mean, this will not end up in two times a position, but both will accumulated in the one bar-call. DefParam CumulateOrders = false won’t help here.
IF NOT OnMarket AND a and b THEN
BUY PositionSize Contracts AT MARKET
ELSIF Not OnMarket AND a and b and c THEN
BUY PositionSize/2 Contracts AT MARKET
ENDIF
Maybe that will work better. 🙂
JSParticipant
Senior
Hi @jhon,
First test the entry with the most conditions, then the entry with the second most…etc.
Otherwise you will endup with a wrong PositionSize.
Use CumulateOrders = False to prevent cumulated orders.
DefParam CumulateOrders = False
If a and b and c then
Buy PositionSize/2 Contracts at Market
ElsIf a and b then
Buy PositionSize Contracts at Market
EndIf
Thank you very much JS.
I see that the problem I had was because of the order of the entries, your last post.
For the rest, I was using that same code.
It is curious, the order of the factors does alter the product. 🙂