I have various strategies where I would like to set the position size based on how the strategy is doing. Sadly I never really found a thread where this was covered. A few years ago I just used "by account value" of Strategy Analyzer in NT7 but in NT 8 this is not available.
So three things would need to be done.
1. Setting up the account with an initial value.
(Declaring a double variable?)
2. Calculating position size based on last stock price
(Divide part of account value by last available instrument price and round down)
3. Update account value based on the latest total net profit discarding the initial setup value and adding or subtracting from that
I tried a bit but nothing worked and just gave me various errors. However, I think this should be rather straightforward.
I just need some sample code where this is somehow demonstrated.
Comment