Reply

Help with triggering 2nd order

2 replies

ssdex

Customer, bbp_participant, community, 99 replies.

Visit profile

9 years ago #113320

Hello,

 

I’m having trouble working out how to get the next order after a loss to take a different lot size. 

 

IF(buy rules)=True

Then(assign variable) = 1

 

IF(variable)=1 

Then(enter buy)

(assign variable) = 0

 

 

The above code works all day long. The problem is in the next piece (I think).

 

IF(closed p/l 0,0) <0

Then (assign variable) = 2

 

IF(variable)=2

&& (buy rules) = true

THEN(enter buy w/larger lot)

 

This seems to never take the larger trade after a loss. Is there something I’m missing?

 

Thanks for any help with this issue.

 

James

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

9 years ago #128799

if it doesn’t work it looks like the second two rules are never triggered.

It depends also on how exactly it is done, if you’ll post the strategy here I can look at it.

 

You should be aware that rules are evaluated in order they are created, so your first rule always sets the variable to 1, and your second rule then always make a trade.

Mark
StrategyQuant architect

0

ssdex

Customer, bbp_participant, community, 99 replies.

Visit profile

9 years ago #128843

Thanks Mark.

 

I finally reversed the order and the trades execute correctly.

 

Thanks again.

0

Viewing 2 replies - 1 through 2 (of 2 total)