Hi all,
Does anyone know how to put a maximum condition around DEFPARAM CumulateOrders = True ?
Something like this, returns a Syntax error:
if maxposition then
DEFPARAM CumulateOrders = True
endif
Maxposition = countofposition[0]<50 and countofposition[0]>-50 //Max 50 long or 50 Short
Wrapping the If statement around the Entry trade order doesn’t work either because the system will add to a position >50 and then not exit the entire position and is then stopped out.
I.e. Position was 48. TS added 12 to give 60. Since 60 > 50 the TS then doesn’t exit.
DEFPARAM must be the very first instruction(s) at the beginning of the code, it can’t be anything else above it and so you can’t wrap it in in any condition.
Hi Grizzly I’m intrigued on something that will open up to 50 positions.
Why have you got: “countofposition[0]>-50" What's the intention?
Both Long and Short positions are absolute?
Also why not just code it like:
Maxposition = COUNTOFPOSITION <= 50
Hi dwgfx – Because it needs a lower bound for short positions. Otherwise cumulate orders can exceed -50…-100…-200 etc
Hi grizzly. I have just come across your topic from last year. I don’t know where you got on it however I’ve been looking at it recently and there is a discussion I set up (and solutions) here:
Limiting accumulating orders & Fuse
Hope this helps