I built one in TOS, although ugly, it works. But I have no clue how to do it in Tradovate. Here it is:
Settings:
Enter RISK in $ (ie. $150)
TICK VALUE
Operation:
RANGE = (Last price - current bar low - 1 tick)
TRADERISK= (RANGE x TICKVALUE)
RISK / TRADERISK
Output would be position size. Stop loss is one tick below current price.
Then I would do the same thing but base it off of previous candle.
It would need to work for both long and short positions.
Here is my ugly but functional thinkorswim script. Buffer is just adding the stop loss distance from low of candle and digits was to round the position size number down.
input RiskUnit = 150;
input buffer = .00;
input digits = 0;
def price = close(priceType = PriceType.LAST);
def candleRangeBull = price - low + buffer;
def candleRangeBear = high - price + buffer;
def BullRisk = (RiskUnit) / round(candleRangeBull);
def BearRisk = (RiskUnit) / round(candleRangeBear);
def BullRisk1 = rounddown(Bullrisk, digits);
def BearRisk1 = rounddown(Bearrisk, digits);
def o = open;
AddLabel(yes, "Risk: " + AsDollars(RiskUnit) + " CurrentBar : "+ (if price > o then BullRisk1 else BearRisk1), if price > o then Color.GREEN else Color.RED);
Here is same thing but based off previous candle:
input RiskUnit = 150;
input roundshares = 0;
input rounddiff = 0;
input buffer = .00;
def prevCandleRange = high[1] - low[1] + buffer;
def r = (RiskUnit) / prevCandleRange;
def r2 = roundDown(r, roundshares);
def o = open[1];
def c = close[1];
AddLabel(yes, "Risk: " + AsDollars(RiskUnit) + " PreviousBar: " + r2, if o > c then Color.GREEN else Color.RED);
I’d be willing to pay a reasonable amount if anyone can build it for me.