Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
BarsAgo of a drawing dot
Collapse
X
-
BarsAgo of a drawing dot
I am working with the indicator ColoredSMADrawAnswer which draws a green dot when the SMA switches from Falling to Rising and draws a red dot when the SMA switches from Rising to Falling. I am scripting a Strategy that accesses the indicator and I want to the Strategy to only enter on the next bar after the Dot is drawn. How do I reference the drawing object (which is drawn by the indicator) by the strategy and only set it to enter if the Dot was drawn one bar ago?Tags: None
-
You would be better off trying to get the Rising and Falling pattern instead of the draw object. Do you what exactly the Indicator is checking for on the Rising and Falling?
NS has methods available for this respectively called Rising() and Falling() which return a bool
Edit: The reason for this is that you don't get the Draw Object from the indicator. You would use the DrawObjects Collection to see what objects are drawn on the chart and then process it that way. More of a pain instead of using the same pattern as the indicator is using in the first place
-
Hello kennyb59,
Thanks for posting today.
You may not have to reference the object that you drew. If you know when you drew the object you can track when that object was drawn, track it from the drawing condition.
Then when the next bar updates if the object was drawn in the last bar then you can have your entry statement.
If you are using CalculateOnBarClose = true; then you will only need a simple boolean statement to determine when the dot was drawn. After the dot is drawn set it to true. The next bar will update and check if the boolean is true and entry or reset the object is drawn boolean.
Please let us know if we may be of further assistance for anything NinjaTrader.Alex G.NinjaTrader Customer Service
Comment
-
Thx for your quick reply. The drawn dot is based on the Rising and Falling Conditions and a bool called DotSwitch so if Rising and DotSwitch draw a green dot and if Falling and not DotSwitch draw a red dot. I only want entries 1 bar after the drawn dots.
Comment
-
Hello kennyb59,
Thanks for the reply.
To clarify you can track this by placing some object to track the bars within the condition statement of when the drawing object is drawn.
For example
Code:int barWhenEntered =-1 ... if (some condition) { //where DrawDot is called DrawDot("tag", true, 0, Low[0],Color.Blue); barWhenEntered = CurrentBar }
Please let us know if we may be of further assistance for anything NinjaTrader.Alex G.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Conall, Today, 12:06 AM
|
0 responses
3 views
0 likes
|
Last Post
by Conall
Today, 12:06 AM
|
||
Started by proptradingshop, 03-21-2024, 09:50 AM
|
6 responses
27 views
0 likes
|
Last Post Today, 12:02 AM | ||
Started by mly916, Yesterday, 09:48 PM
|
1 response
11 views
0 likes
|
Last Post Yesterday, 11:54 PM | ||
Started by Mikey_, Yesterday, 09:21 PM
|
0 responses
11 views
0 likes
|
Last Post
by Mikey_
Yesterday, 09:21 PM
|
||
Started by cre8able, Yesterday, 05:53 PM
|
3 responses
14 views
0 likes
|
Last Post
by cre8able
Yesterday, 09:20 PM
|
Comment