I am experiencing difficulties regarding position sizing in my code. What I would like to do is to enter positions based on my current account balance instead of entering a position with a default of 10k.
So far I have tried using the GetAccountValue function. when i go to compile the code, everything is fine. However when i go to backtest, it is opening one dollar positions.
here is the buying criterion section of my code:
if ((HAupperwick/HAbody)>1.2&&HAlowerwick<HAbody/20)// buying criterion { EnterLong((int)GetAccountValue(AccountItem.BuyingPower), ""); EntryPrice=GetCurrentBid(); SetTrailStop(CalculationMode.Ticks, SL); }
Comment