"Bars.Close" event in IOG mode

Questions about MultiCharts .NET and user contributed studies.
lewisthegood
Posts: 21
Joined: 08 Mar 2021

"Bars.Close" event in IOG mode

Postby lewisthegood » 17 Sep 2022

In default mode, i know that the script is calculated at the close of the bar, and "Bars.Close[0]" event means the close of the current bar.

In IOG mode, i know that the script is calculated on each tick, but I need to confirm that "Bars.Close" in IOG mode means the close of the each tick instead of the close of the bar? For example in IOG mode, Bars.Close[0] - Bars.Close[1] will return the close of the current tick minus the close of the previous tick....? If that is correct, I just want to find a solution to calculate "Bars.Close[0] - Bars.Close[1]" for the close of the bars, instead of the close of each tick in IOG mode.

User avatar
ABC
Posts: 677
Joined: 16 Dec 2006
Has thanked: 121 times
Been thanked: 382 times
Contact:

Re: "Bars.Close" event in IOG mode

Postby ABC » 19 Sep 2022

lewisthegood,

Bars.Close[1] will always be the value of the closing tick for the previous bar - the behavior is the same whether or not IOG is enabled.

Regards,

ABC

lewisthegood
Posts: 21
Joined: 08 Mar 2021

Re: "Bars.Close" event in IOG mode

Postby lewisthegood » 19 Sep 2022

Is there a way to calculate the script at bar close (to check the conditions for sending orders) , but calculate the script with IOG mode once a trade is opened to take profit/ cut loss?

User avatar
ABC
Posts: 677
Joined: 16 Dec 2006
Has thanked: 121 times
Been thanked: 382 times
Contact:

Re: "Bars.Close" event in IOG mode

Postby ABC » 20 Sep 2022

lewisthegood,

you could for example compute parts of your logic depending on Bars.Status and only evaluate the code block for the closing tick.

Regards,

ABC


Return to “MultiCharts .NET”