A simple situation. A Script that runs with CalculateOnBarClose = True, then when a new Bar is beginning, I'd like to call its current Open. Is it as simple as calling Open[0] setting previously CalculateOnBarClose = False ?
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
How to get the current open of a building Bar?
Collapse
X
-
How to get the current open of a building Bar?
Hi Ninjas,
A simple situation. A Script that runs with CalculateOnBarClose = True, then when a new Bar is beginning, I'd like to call its current Open. Is it as simple as calling Open[0] setting previously CalculateOnBarClose = False ?Tags: None
-
Hi Pstrusi,
Yes, in order to get the most current bar being built you will need to have the script run with CalculateOnBarClose set to false. You can then filter it out with FirstTickOfBar.
This will be true when a new bar is built.
http://www.ninjatrader.com/support/h...ttickofbar.htmCal H.NinjaTrader Customer Service
-
But I have this doubt: in order to get the proper signals from the Script, this must evaluate the Close, Open and Median of the last closed Bar; if I use tick by tick Bar, how can I call this?
Allow me to explain clearly the situation:
The Script evaluates Bar by Bar ( CalculateOnBarClose = True ) But when a signal entry is received, the Script must trigger an order at the price of the FirstTick of the next bar, so this is why I'm askingLast edited by pstrusi; 12-16-2013, 07:20 AM.
Comment
-
Not sure how, cause I'm still using CalculateOnBarClose=False. Do you mind to show me how to set and call this serie 1?
If I'm using CalculateOnBarClose=False, any new Bar Object will be filtered through the tick by tick method, right? then how can I set a Bar object series that carries Close, Open and Median that I need for my calculations?Last edited by pstrusi; 12-16-2013, 07:49 AM.
Comment
-
Pstrusi,
Example of this in use is below -
Code:protected override void OnBarUpdate() { if(FirstTickOfBar) { if(SMA(14)[1] > SMA(7)[1]) { EnterLongLimit( 5, Close[1], "Long1"); } } }
Cal H.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Cal View PostPstrusi,
Example of this in use is below -
Code:protected override void OnBarUpdate() { if(FirstTickOfBar) { if(SMA(14)[1] > SMA(7)[1]) { EnterLongLimit( 5, Close[1], "Long1"); } } }
Comment
-
I imagined that. Allow me to remind my simple request:
I got a script that evaluates closed Bar by Closed Bar ( CalculateOnBarClose = True ), once the last closed Bar is evaluated, the script triggers an Limit Order ( BUY or SELL ) that it should be at the same price of the FirstTickofBar ( obvious the next active Bar ), so as you can see the conflict is obvious because I'd need two opposite CalculateOnBarClose ( True and False )
So my question:
How could I achieve this ?
Comment
-
the conflict is obvious because I'd need two opposite CalculateOnBarClose ( True and False )
This allows you to simulate a CalculateOnBarClose set to true and run your script on a bar by bar calculation while running it set to false on the chart.Cal H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by jaybedreamin, Today, 05:56 PM
|
0 responses
7 views
0 likes
|
Last Post
by jaybedreamin
Today, 05:56 PM
|
||
Started by DJ888, 04-16-2024, 06:09 PM
|
6 responses
18 views
0 likes
|
Last Post
by DJ888
Today, 05:12 PM
|
||
Started by Jon17, Today, 04:33 PM
|
0 responses
1 view
0 likes
|
Last Post
by Jon17
Today, 04:33 PM
|
||
Started by Javierw.ok, Today, 04:12 PM
|
0 responses
9 views
0 likes
|
Last Post
by Javierw.ok
Today, 04:12 PM
|
||
Started by timmbbo, Today, 08:59 AM
|
2 responses
10 views
0 likes
|
Last Post
by bltdavid
Today, 04:10 PM
|
Comment