I refer to the sample code for drawing buttons on the chart:
https://ninjatraderecosystem.com/use...jE3MjQxNTUwNTk.
Basically, the buttons are drawn within:
else if (State == State.Historical)
which runs a separate method:
private void OnButtonClick
, which triggers a boolean longButtonClicked to true if the buy button is clicked.
In OnBarUpdate, every bar update checks for the conditions whereby longButtonClicked is true, and bar conditions relating to High[0], High[1] and Low[1] are met. If so, a long position is entered.
Say for my situation, I run Caculate.OnPriceChange, and I do not wish to check for any bar conditions. When I click on the Buy button, I want the long position to be entered as soon as possible.
Do I still need to route the logic through OnBarUpdate?
If I just enter long from:
private void OnButtonClick
and bypassing OnBarUpdate altogether, would it cause any problems?
What is the best practice?
Appreciate your assistance.
Comment