Sorry in advance for lenght of my question. I use the following fixed variables:
MaxRisk: $40
Funds: $2000
Variables: Riskcents = ATR * X
Shares = MaxRisk / Riskcents
MaxInvest= candle "High" * Shares
I'm trying to generate a calculation of variable "X" such that the "Shares" * candle "High" will a MaxInvest that equals Funds. Obviously I can have a fixed user input for X to start the evaluation; but, then need the code that will evaluate and increment/decrement "X" so that Maxinvest = Funds. Any assistance is greatly appreciated.
I want to add that when intraday trading, and using a fixed "X" of 2, the ATR can become so small that the number of "Shares" results in a MaxInvest that exceed Funds. That where the "rub" is...I'd like the code to calculate the adjustment needed.
MaxRisk: $40
Funds: $2000
Variables: Riskcents = ATR * X
Shares = MaxRisk / Riskcents
MaxInvest= candle "High" * Shares
I'm trying to generate a calculation of variable "X" such that the "Shares" * candle "High" will a MaxInvest that equals Funds. Obviously I can have a fixed user input for X to start the evaluation; but, then need the code that will evaluate and increment/decrement "X" so that Maxinvest = Funds. Any assistance is greatly appreciated.
I want to add that when intraday trading, and using a fixed "X" of 2, the ATR can become so small that the number of "Shares" results in a MaxInvest that exceed Funds. That where the "rub" is...I'd like the code to calculate the adjustment needed.
Last edited: