Validate Position Sizing Code

I am trying to code Van Tharp Position Sizing to backtest one of my strategy, here is the code:

RiskPct = 1;
EntrySignal = HHV(H,_HHVOpt);
ExitSignal = LLV(L,_LLVOpt);
Stopsize = EntrySignal - ExitSignal;
SetPositionSize((RiskPct/Stopsize) * C, spsPercentOfEquity);
RoundLotSize = 1;

Is this correct approach?

Check out this page

1 Like

Thanks @codejunkie was very helpful