After Intra-Bar Order Generation (IOG) enabled, then variable reset  [SOLVED]

Questions about MultiCharts and user contributed studies.
kinwai
Posts: 89
Joined: 03 May 2019
Has thanked: 12 times
Been thanked: 1 time

After Intra-Bar Order Generation (IOG) enabled, then variable reset

Postby kinwai » 07 Oct 2019

In 1 min timeframe,

When Intra-Bar Order Generation (IOG) disabled, I set a variable, I could get it in next bar (next min)..

When Intra-Bar Order Generation (IOG) enabled, I set a variable, but it will reset in next OHLC bar. Any idea?

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: After Intra-Bar Order Generation (IOG) enabled, then variable reset

Postby TJ » 07 Oct 2019

In 1 min timeframe,

When Intra-Bar Order Generation (IOG) disabled, I set a variable, I could get it in next bar (next min)..

When Intra-Bar Order Generation (IOG) enabled, I set a variable, but it will reset in next OHLC bar. Any idea?
If this is a coding question, please post a snippet of your codes.

kinwai
Posts: 89
Joined: 03 May 2019
Has thanked: 12 times
Been thanked: 1 time

Re: After Intra-Bar Order Generation (IOG) enabled, then variable reset

Postby kinwai » 07 Oct 2019

The code likes below, I use signalCount to count number of signal and only place order when signalCount = 0.

if signalCount = 0 then
begin
Buy next bar at market;
signalCount = signalCount + 1;
end;

if date > date[1] then
signalCount = 0;

It works when IOG disabled. However, when IOG enabled, the signalCount will always be 0 in all coming OHLC bars even the date doesn’t change.

kinwai
Posts: 89
Joined: 03 May 2019
Has thanked: 12 times
Been thanked: 1 time

Re: After Intra-Bar Order Generation (IOG) enabled, then variable reset

Postby kinwai » 07 Oct 2019

One supplement, I tried to print the signalCount after + 1 to prove that the variable is updated to “1”, but in next bar, it reset to “0” again

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: After Intra-Bar Order Generation (IOG) enabled, then variable reset

Postby TJ » 08 Oct 2019

See post #1 & #2
viewtopic.php?t=11713

kinwai
Posts: 89
Joined: 03 May 2019
Has thanked: 12 times
Been thanked: 1 time

Re: After Intra-Bar Order Generation (IOG) enabled, then variable reset

Postby kinwai » 08 Oct 2019

Here is the sample, the variable signalCount reset in next bar when IOG enabled.

Code: Select all

if signalCount = 0 then
begin
Buy next bar at market;
signalCount = signalCount + 1;
end;

if date > date[1] then
signalCount = 0;

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: After Intra-Bar Order Generation (IOG) enabled, then variable reset

Postby TJ » 08 Oct 2019

Go to Wiki
Go to PowerLanguage Keyword Reference
Look under Declaration‎ (28 P)

IntraBarPersist

https://www.multicharts.com/trading-sof ... _Reference

kinwai
Posts: 89
Joined: 03 May 2019
Has thanked: 12 times
Been thanked: 1 time

Re: After Intra-Bar Order Generation (IOG) enabled, then variable reset  [SOLVED]

Postby kinwai » 08 Oct 2019

It works, thanks,

kinwai
Posts: 89
Joined: 03 May 2019
Has thanked: 12 times
Been thanked: 1 time

Re: After Intra-Bar Order Generation (IOG) enabled, then variable reset

Postby kinwai » 08 Oct 2019

After declared IntraBarPersist variable, most of the bar works to keep the value, but still have some bars reset the variable, any clue?

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: After Intra-Bar Order Generation (IOG) enabled, then variable reset

Postby TJ » 08 Oct 2019

After declared IntraBarPersist variable, most of the bar works to keep the value, but still have some bars reset the variable, any clue?
See post #2

kinwai
Posts: 89
Joined: 03 May 2019
Has thanked: 12 times
Been thanked: 1 time

Re: After Intra-Bar Order Generation (IOG) enabled, then variable reset

Postby kinwai » 08 Oct 2019

Do you mean “How to get help” post 2? It is only for code tag.

Post #2 of this thread.


Return to “MultiCharts”