Hourly bars values in IOG script  [SOLVED]

Questions about MultiCharts and user contributed studies.
auato
Posts: 89
Joined: 23 Nov 2016
Has thanked: 18 times

Hourly bars values in IOG script

Postby auato » 22 Apr 2017

In a IOB script running with hourly time resolution how can I get easily the high, close, low, open values for the previous hourly bars?

Thank you
Last edited by auato on 22 Apr 2017, edited 1 time in total.

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

Re: Hourly bars values in IOB script

Postby TJ » 22 Apr 2017

In a IOB script running with hourly time resolution how can I get easily the high, close, low, open values for the previous hourly bars?

Thank you

What is IOB?

Do you mean IOG?

Please go to wiki and read the definition again carefully.

If you need help interpreting any specific passage, please copy and paste the detail here.

auato
Posts: 89
Joined: 23 Nov 2016
Has thanked: 18 times

Re: Hourly bars values in IOB script  [SOLVED]

Postby auato » 22 Apr 2017

Sorry for the typo. Yes, I mean IOG. :D

On the chart my script thinks on the hourly bars to create some conditions but I also need to enable IOG. If I enable IOG, my script will begin to think on a tick basis and so, if I write

Code: Select all

if h[1]<h[2] AND h<h[1] then Begin...
(that means to intercept three consecutive decreasing High values for three consecutive hourly bars) I presume the scripts will intercept three consecutive decreasing High values for three consecutive ticks after IOB enabling.

The same for the statement
if ((o-c)/o)<THR
I would like to think on the current hourly bar and not the current tick.

Code: Select all

[IntrabarOrderGeneration=True]

if h[1]<h[2] AND h<h[1] then Begin
if ((o-c)/o)<THR AND time<1400 then Begin
sellshort next bar at market;

End;
End;
Last edited by auato on 22 Apr 2017, edited 1 time in total.

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

Re: Hourly bars values in IOB script

Postby TJ » 22 Apr 2017

Sorry for the typo. Yes, I mean IOG. :D
::

I would like to think on the current hourly bar and not the current tick.

I will say it again,


Please go to wiki and read the definition again carefully.

If you need help interpreting any specific passage, please copy and paste the passage here.


ie. which passage that says "tick" or "bar" that is bothering you?

auato
Posts: 89
Joined: 23 Nov 2016
Has thanked: 18 times

Re: Hourly bars values in IOG script

Postby auato » 22 Apr 2017

I am doing it, TJ. There is no passage that is bothering me. I can't figure out a solution tailored or me.
In IOG script running on a hourly chart if I write High<High[1] what does it mean? Does it mean that the High value of the current hourly bar is lower than the High of previous hour or it means that the High value of the current tick is lower than the High of previous tick??

Maybe a good solution is to use currentbar and lastbaronchart if they refer to the real bar shown on the chart but it is not specified.
Last edited by auato on 22 Apr 2017, edited 1 time in total.

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

Re: Hourly bars values in IOB script

Postby TJ » 22 Apr 2017

auato:

Let's go through the Wiki together
Let's get a few things straight:

1. The keyword is IntraBarOrderGeneration. ie as the name implies, it is for Order Generation, nothing else.

2. The first line in the definition:
Toggles intra-bar order generation flag on or off.
3. Keyword Usage:
If set to True... Enable intra-bar order generation and calculation...
4. Keyword Example:
Will generate a buy order that is active for the next tick only.

THIS KEYWORD is for ORDER GENERATION ONLY
Nothing else applies.

auato
Posts: 89
Joined: 23 Nov 2016
Has thanked: 18 times

Re: Hourly bars values in IOG script

Postby auato » 22 Apr 2017

oh Thank you @TJ. I was convinced that after IOG enabling all would become related to tick.

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

Re: Hourly bars values in IOG script

Postby TJ » 22 Apr 2017

oh Thank you @TJ. I was convinced that after IOG enabling all would become related to tick.


That's why I asked you to read AGAIN and read CAREFULLY.

auato
Posts: 89
Joined: 23 Nov 2016
Has thanked: 18 times

Re: Hourly bars values in IOG script

Postby auato » 22 Apr 2017

Yes you are right but I have read a lot of times thinking wrong every time and only focusing on what my mind wanted to think.

auato
Posts: 89
Joined: 23 Nov 2016
Has thanked: 18 times

Re: Hourly bars values in IOG script

Postby auato » 22 Apr 2017

One more thing... in my code I also have:

if ((o-c)/o)<THR

this means that the entry will be triggered only for the next tick of the next hourly bar as in the moment of the calculation I don't know the close of the current bar. Is it correct?

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

Re: Hourly bars values in IOG script

Postby TJ » 22 Apr 2017

Without IOG,

Your logic is evaluated at the end of the bar (EOB).

If the BUY/SELL condition is MET... the order will be generated at the NEXT bar.


With IOG,

Your logic is evaluated EVERY tick.

If the BUY/SELL condition is MET... the order will be generated at the NEXT tick.

IOG is about ORDER GENERATION.
If the condition is met, an oreder is generated.

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

Re: Hourly bars values in IOG script

Postby TJ » 22 Apr 2017

One more thing... in my code I also have:

if ((o-c)/o)<THR

this means that the entry will be triggered only for the next tick of the next hourly bar as in the moment of the calculation I don't know the close of the current bar. Is it correct?

Please use a streaming papertrading account to test your logic thoroughly before trading.


Return to “MultiCharts”