IntraBarOrderGeneration question with functions - futures io
futures io



IntraBarOrderGeneration question with functions


Discussion in MultiCharts

Updated
    1. trending_up 2,109 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 6 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 150,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

IntraBarOrderGeneration question with functions

(login for full post details)
  #1 (permalink)
 Sinatra Fan 
Orlando FL
 
Experience: Intermediate
Platform: MultiCharts, Ninja
Trading: Emini ES
 
Sinatra Fan's Avatar
 
Posts: 58 since May 2019
Thanks: 7 given, 8 received

I am in the process of writing a strategy using Flex Renko bars. One of my challenges is that at the end of the day, I want to close out any open positions at 4:05 PM EST. Well because of the nature of a renko bar, any given renko bar can take an unknown amount of time to complete as time has no function in the formation of a renko bar. That is the problem.

So my strategy works great except for the end of day. I figure the only way to combat this problem is to run the strategy on a intrabar basis. So, given that I often use the barstatus, I can instruct most of the program to test at the end of each bar. Moreover, I use functions early and often. I find that it's easier for me to troubleshoot problems if I break my strategy into functions and use the strategy as the general flowchart and direct it to functions based on basic logical tests.

So in the beginning of my strategy, I have a function that calculates trading sessions as well as times where it's ok to enter into trades. Of course, when the trading session ends, the strategy would exit any open positions.

So... can I use the reserve word IntraBarOrderGeneration in a function? If so, is there anything I need to be mindful of when coding. I did see somewhere where this RW is only applicable to strategies. Does this mean I can't use it in functions???

EDIT: Let me ask you this. If I call on the function on a tick by tick basis (by not waiting for Barstatus = 2) then the function will cycle each and every tick, correct? If so, then I really don't need to worry about this RW right? Please clarify. Thanks

Thanks for the help

Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
Learning Day Trading, need some advice on approach advice
Traders Hideout
NT8 - Footprint Chart adding on code
NinjaTrader
 
 
(login for full post details)
  #2 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,332 since Apr 2013
Thanks: 425 given, 1,551 received

Sinatra Fan,

the IntraBarOrderGeneration attribute is used for strategies. You do not need this in a function as the frequency of its computation depends on the calling code.
Having said that, you can call a function with every tick.

I would suggest testing this with a simple test code.

Regards,

ABCTG



Sinatra Fan View Post
I am in the process of writing a strategy using Flex Renko bars. One of my challenges is that at the end of the day, I want to close out any open positions at 4:05 PM EST. Well because of the nature of a renko bar, any given renko bar can take an unknown amount of time to complete as time has no function in the formation of a renko bar. That is the problem.

So my strategy works great except for the end of day. I figure the only way to combat this problem is to run the strategy on a intrabar basis. So, given that I often use the barstatus, I can instruct most of the program to test at the end of each bar. Moreover, I use functions early and often. I find that it's easier for me to troubleshoot problems if I break my strategy into functions and use the strategy as the general flowchart and direct it to functions based on basic logical tests.

So in the beginning of my strategy, I have a function that calculates trading sessions as well as times where it's ok to enter into trades. Of course, when the trading session ends, the strategy would exit any open positions.

So... can I use the reserve word IntraBarOrderGeneration in a function? If so, is there anything I need to be mindful of when coding. I did see somewhere where this RW is only applicable to strategies. Does this mean I can't use it in functions???

EDIT: Let me ask you this. If I call on the function on a tick by tick basis (by not waiting for Barstatus = 2) then the function will cycle each and every tick, correct? If so, then I really don't need to worry about this RW right? Please clarify. Thanks

Thanks for the help


Follow me on Twitter Reply With Quote
The following user says Thank You to ABCTG for this post:
 
(login for full post details)
  #3 (permalink)
 Sinatra Fan 
Orlando FL
 
Experience: Intermediate
Platform: MultiCharts, Ninja
Trading: Emini ES
 
Sinatra Fan's Avatar
 
Posts: 58 since May 2019
Thanks: 7 given, 8 received


What about the RW "INTRABARPERSIST"???

Should I use this in a function?

EDIT... Just tried to use it and it seems that it won't compile.

Started this thread Reply With Quote
 
(login for full post details)
  #4 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,332 since Apr 2013
Thanks: 425 given, 1,551 received

Sinatra Fan,

the reserved word "intrabarpersist" works fine in functions. Whether or not it is required in your code depends on your code logic.

Regards,

ABCTG


Sinatra Fan View Post
What about the RW "INTRABARPERSIST"???

Should I use this in a function?

EDIT... Just tried to use it and it seems that it won't compile.


Follow me on Twitter Reply With Quote
 
(login for full post details)
  #5 (permalink)
 Sinatra Fan 
Orlando FL
 
Experience: Intermediate
Platform: MultiCharts, Ninja
Trading: Emini ES
 
Sinatra Fan's Avatar
 
Posts: 58 since May 2019
Thanks: 7 given, 8 received


ABCTG View Post
Sinatra Fan,

the reserved word "intrabarpersist" works fine in functions. Whether or not it is required in your code depends on your code logic.

Regards,

ABCTG

OK, so the message I got when I tried it on a function was "This attribute can be applied only for variables"

Then I realized that I tried using it on input values. So basically if I understand one of your previous posts, it the function is called in the middle of the bar because the strat is operating on a tick by tick basis, the function should make the evaluation using the current information, correct?

Started this thread Reply With Quote
 
(login for full post details)
  #6 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,332 since Apr 2013
Thanks: 425 given, 1,551 received

Sinatra Fan,

sounds correct. For functions you do not set the IntraBarOrderGeneration attribute, the frequency of the function being called is determined by the calling code. If you need the function's variables to be updated with every tick, they need to be intrabarpersist, though.

Regards,

ABCTG


Sinatra Fan View Post
OK, so the message I got when I tried it on a function was "This attribute can be applied only for variables"

Then I realized that I tried using it on input values. So basically if I understand one of your previous posts, it the function is called in the middle of the bar because the strat is operating on a tick by tick basis, the function should make the evaluation using the current information, correct?


Follow me on Twitter Reply With Quote
 
(login for full post details)
  #7 (permalink)
 Sinatra Fan 
Orlando FL
 
Experience: Intermediate
Platform: MultiCharts, Ninja
Trading: Emini ES
 
Sinatra Fan's Avatar
 
Posts: 58 since May 2019
Thanks: 7 given, 8 received

OK, so I'm really getting frustrated.

I managed to put together a strategy that layers in and out successfully. My only problem seemed to be that because I am using a FLEX RENKO chart, by using a strat that tests at the end of each bar, my end of day code may leave the position open because the bar didn't close before the session ended.

So... I decided to use [IntraBarOrderGeneration = True] and run the strat with Barstatus = 2 for all but the end of day check which is tick by tick. When I did this... my layers will not close right anymore. WHY?

Just to check things out... as a test, I pasted "[IntraBarOrderGeneration = True]" to a previous version of the strat and compiled it and sure enough, the layers didn't close there either. HOWEVER, when I deleted that statement and re-compiled, the layers remain unclosed as if the statement was still there.

EDIT: I tried one more thing... I deleted the test previous strat from the chart, then reinstalled it and it's back to working correctly again. So again I ask... why would this act this way? What is it about IBOG that messes up my layers closing correctly?

WTF??? Please let me know what I'm doing wrong. Thanks

Started this thread Reply With Quote


futures io Trading Community Platforms and Indicators MultiCharts > IntraBarOrderGeneration question with functions


Last Updated on October 20, 2021


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2022 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts