Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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);

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mastering Islamic Finance

Authors: Faizal Karbani

1st Edition

1292001445, 978-1292001449

More Books

Students also viewed these Finance questions