Question: Please help. Implementing trading bot Problem: For every new bar formed on a stock, the trading bot will open a new position[idx] with new order
Please help. Implementing trading bot
Problem: For every new bar formed on a stock, the trading bot will open a new position[idx] with new order transactions[idx], where idx is the total number of trading bars during a day, idx starts at zero. Therefore, The bot will be able to access any trading position and its order transactions such a entry orders or exit orders.
How to use a valid index out of the bounds of the array below?
public override void Execute(BarHistory bars, int idx) { int index = idx;
bool condition0; val = bars.averageOHLC[idx];
Transaction[] _transaction = new Transaction[30000]; Position[] _foundposition = new Position[30000];
_foundposition[idx] = FindOpenPosition(idx); transaction[idx] = transaction[idx];
if(_foundposition[idx]==null){
}
_foundposition[idx] = FindOpenPosition(idx);

Eute Exception (AMZN,0) Line 52 - Index was outside the bounds of the array. WealthScript2.MyStrategy.Execute(BarHistory bars, Int32 idx) in :line 52 WealthLab.Backtest.UserStrategyExecutor.PushConfig(List'1 Ist, DateTime dt)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
