I know that hedge betting is generally a fool's bet. But there may be
some rare instances when I want both a Long position and a Short
position open at the same time (still experimenting with that concept).

Anyway, I can't get the backtester to have two such trades open
simultaneously and hope someone can be of help. According to my
understanding the below code placed at the begining of the formula
(especially the bolded lines) are correct for hedging. And in the
backtester General Settings I should set Positions to "Long and Short",
and uncheck the box for "Reverse entry signal forces exit". I have done
that, but still the backtester does not allow a Long or Short to be open
when the reverse is already open.

Any help much appreciated.

SetBarsRequired(10000, 10000);
SetFormulaName("1-0 Initial Attempt");
SetOption("CommissionAmount", 4.00);
SetOption("CommissionMode", 2);
SetOption("InitialEquity", 100000);
SetOption("MaxOpenPositions", 2);
SetOption("PriceBoundChecking", 1);
SetOption("UsePrevBarEquityForPosSizing", 1);
SetTradeDelays( 1, 1, 1, 1 );
SetPositionSize(1,spsShares);
SetOption( "ReverseSignalForcesExit", 0 );

Reply via email to