Have a look at my last uploaded graphic rappresentation. As you see on the chart currenly we are missing out some important long entries. Probably i am not expressing myself properly, but to sum up what i want to be able to capute are all those green trigger levels rerted on the left hand side chart.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
DrawLine Help
Collapse
X
-
If this is not what you ment, but you were refering to how to capturing the different signals whilst they are forming, wouldn't that be possible by lets say having 3+ different plots? So if we have a setup that starts forming whilst an other setup is forming we would be able to capture both of these? For example if we get a series of 5 consecutive lower lows, that would create 3 different trigger levels on my chart. But at this moment, with the proposed code, we would be capturing only the first forming trigger, that would be also the less likely to trade, if you immagine 5 identical consecutive lower low bars.
Have a look at my last uploaded graphic rappresentation. As you see on the chart currenly we are missing out some important long entries. Probably i am not expressing myself properly, but to sum up what i want to be able to capute are all those green trigger levels rerted on the left hand side chart.Last edited by sburtt; 02-19-2013, 12:57 AM.
-
You asked for an indicator to give you levels that you would use to trade a strategy. Right now I thought that you were focused on how to pass capture and pass relevant data to from your indicator to your strategy.Originally posted by sburtt View PostWouldn't this be possible by simply checking the market position before going long, and ignoring the trigger levels when the position is already long, by handling only single entries? Something like this:Code:However, if you do as you say, how then do you handle your overlapping setups?
Code:if (Position.MarketPosition == MarketPosition.Flat)
I should think that your strategy proposed methods are a different kettle of fish. But yes, checking your current position is always a good idea.
Comment
-
The problem here is that you seem to be thinking in very specific terms, without taking into account that your data will not behave as you expect. What if you have 8 consecutive lower lows for example. Now you have only 3 Plots. What then? That is why I said that you would have to predefine your Plots. How many? I have no idea.Originally posted by sburtt View PostIf this is not what you ment, but you were refering to how to capturing the different signals whilst they are forming, wouldn't that be possible by lets say having 3+ different plots? So if we have a setup that starts forming whilst an other setup is forming we would be able to capture both of these? For example if we get a series of 5 consecutive lower lows, that would create 3 different trigger levels on my chart. But at this moment, with the proposed code, we would be capturing only the first forming trigger, that would be also the less likely to trade, if you immagine 5 identical consecutive lower low bars.
That sounds contradictory. You say you want to see old levels to 5 bars, and at the same time you are complaining that doing so means that you do not see the new levels. I specifically said you would either see "most recent", or "first in progress". You asked how to see "first in progress" which I showed you. I had already shown you "most recent", which will show you all levels as they develop, on the natural assumption that old levels become irrelevant as soon as a new setup develops.Have a look at my last uploaded graphic rappresentation. As you see on the chart currenly we are missing out some important long entries. Probably i am not expressing myself properly, but to sum up what i want to be able to capute are all those green trigger levels rerted on the left hand side chart.
I explained to you that if you want to visually represent all levels then you would need to use lines (as you do not know beforehand now many Plots you might need), and if you wanted information of the all levels then you needed to make arrangements to store the values and retrieve them.
There is really little more that I can say, beyond what I have already said, which I summarize below.- Draw the levels.
- If you want to handle all levels including those that have been subject to a new setup, then store the levels in an ArrayList.
- Remove stale entries (those that have lasted for 5 bars, according to your description).
- Pass the ArrayList to the Strategy, so that it knows what levels are to be used.
- Let the Strategy read and use those levels as needed.
OTOH, if you want to use only the most recent levels, then all you need is a Plot that you can either validate before strategy entries, or you can actually pass and use the bool mayEnterLong, as a gate, and the Plot as the entry level.Last edited by koganam; 02-19-2013, 03:23 AM.
Comment
-
I might be wrong, but I think the answer is we need 5 plots and we need to use "first in progress", so each plot will not process a new setup when one is already in progress. Assume infinte consecutive lows starting to count from bar 0, in this scenario on bar3 plot0 would start forming, on bar4 plot1 will start forming, and so on. on bar7 plot0 will have drawn a segment 5bars long at the price level of bar0's high, hence on bar8 plot0 would start drawing a new segment at the price level of bar5's high, and so on. Does this make sense to you?Code:The problem here is that you seem to be thinking in very specific terms, without taking into account that your data will not behave as you expect. What if you have 8 consecutive lower lows for example. Now you have only 3 Plots. What then? That is why I said that you would have to predefine your Plots. How many? I have no idea.
Comment
-
Yes, and what about if there are 13 consecutive lows. How about 20? How about 26? The point is not how many there are, but how to account for the fact that you do not know how many there will be, so you cannot know how many Plots need to be predeclared at the design time. Again, you are focusing on minor specifics instead of the big picture of the framework in which your code will have to operate.Originally posted by sburtt View PostI might be wrong, but I think the answer is we need 5 plots and we need to use "first in progress", so each plot will not process a new setup when one is already in progress. Assume infinte consecutive lows starting to count from bar 0, in this scenario on bar3 plot0 would start forming, on bar4 plot1 will start forming, and so on. on bar7 plot0 will have drawn a segment 5bars long at the price level of bar0's high, hence on bar8 plot0 would start drawing a new segment at the price level of bar5's high, and so on. Does this make sense to you?Code:The problem here is that you seem to be thinking in very specific terms, without taking into account that your data will not behave as you expect. What if you have 8 consecutive lower lows for example. Now you have only 3 Plots. What then? That is why I said that you would have to predefine your Plots. How many? I have no idea.
Comment
-
The text that I have highlighted in green is in direct contradiction to that in blue. You say in green, to not process new startups when one is in progress, then in blue, to process each new setup while the first is still in progress.Originally posted by sburtt View PostI might be wrong, but I think the answer is we need 5 plots and we need to use "first in progress", so each plot will not process a new setup when one is already in progress. Assume infinte consecutive lows starting to count from bar 0, in this scenario on bar3 plot0 would start forming, on bar4 plot1 will start forming, and so on. on bar7 plot0 will have drawn a segment 5bars long at the price level of bar0's high, hence on bar8 plot0 would start drawing a new segment at the price level of bar5's high, and so on. Does this make sense to you?Code:The problem here is that you seem to be thinking in very specific terms, without taking into account that your data will not behave as you expect. What if you have 8 consecutive lower lows for example. Now you have only 3 Plots. What then? That is why I said that you would have to predefine your Plots. How many? I have no idea.
This is going in circles. I am going to have to disengage, as it is evident that I am failing to get you to see the holes in your descriptions.
Comment
-
Koganam, sorry if I wasted your time. Probably I should have been more clear in the first place. However I don't think that what I am trying to do is impossible. Have a look at the code below, what I was trying to accomplish is making those "Buy Line" displayed on the chart a trigger level to EnterLong
Again, thanks for your patience, most appreciatedCode:{ [Description("")] public class aaatest : Indicator { #region Variables private int plotWidth = 2; #endregion protected override void Initialize() { CalculateOnBarClose = true; Overlay = true; PlotsConfigurable = false; } protected override void OnBarUpdate() { if(CurrentBar < 10) return; if (Low[0] < Low[1] && Low[1] < Low[2]) { DrawLine("Buy Line" + CurrentBar, false, -1, High[2], -5, High[2], Color.Green, DashStyle.Solid, plotWidth); } } #region Properties [Description("Width.")] [Category("Plot Parameters")] [Gui.Design.DisplayNameAttribute("Width")] public int PlotWidth { get { return plotWidth; } set { plotWidth = Math.Max(1, value); } } } #endregion }
Comment
-
Yes it is. It is EXACTLY what I said that you would have to do if you wanted to visually show all lines. This is how I put it in a post in this thread, at 11:02AM, (yesterday) February 18, my time, "If you want to do what you are now describing, you will have to draw lines instead of a Plot. In which case you merely have to draw a line 5 bars long, at the requisite level whenever your triggerCount is greater than 1. " (emphasis added).Originally posted by sburtt View PostKoganam, sorry if I wasted your time. Probably I should have been more clear in the first place. However I don't think that what I am trying to do is impossible. Have a look at the code below, what I was trying to accomplish is making those "Buy Line" displayed on the chart a trigger level to EnterLong
Again, thanks for your patience, most appreciatedCode:{ [Description("")] public class aaatest : Indicator { #region Variables private int plotWidth = 2; #endregion protected override void Initialize() { CalculateOnBarClose = true; Overlay = true; PlotsConfigurable = false; } protected override void OnBarUpdate() { if(CurrentBar < 10) return; if (Low[0] < Low[1] && Low[1] < Low[2]) { DrawLine("Buy Line" + CurrentBar, false, -1, High[2], -5, High[2], Color.Green, DashStyle.Solid, plotWidth); } } #region Properties [Description("Width.")] [Category("Plot Parameters")] [Gui.Design.DisplayNameAttribute("Width")] public int PlotWidth { get { return plotWidth; } set { plotWidth = Math.Max(1, value); } } } #endregion }
Now how are you going to reference it from the Strategy? I am looking at the entire picture of what you claim that you want to do, and how the parts fit together: you seem to be focused on each detail in isolation.
Last edited by koganam; 02-19-2013, 04:19 PM.
Comment
-
what if in the code you first sent me we add a second plot, structured exactly as plot0, but that is based on the following condition?
if (Low[0] < Low[1] && Low[1] < Low[2] && Low[2] < Low[3])
rather than the condition if (Low[0] < Low[1] && Low[1] < Low[2]) we used for plot0?
How would you code this, I tried but with no success, I would appreciate if you could try this for me if it doesn't take too much time. for simplicity I've attached the code we are working on:
Code:{ #region Variables private int triggerCount = 0; private int triggerBar = -1; private int entryKillBar = -1; private bool mayEnterLong = false; private double plotValue = 0; #endregion protected override void Initialize() { Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "Plot0")); Overlay = true; } protected override void OnBarUpdate() { if (CurrentBar < 2) return; //check Trigger condition this.triggerCount = (Low[0] < Low[1]) ? this.triggerCount + 1 : 0; if (this.triggerCount >= 2) this.mayEnterLong = true; if (this.triggerCount == 2) { this.triggerBar = CurrentBar; this.entryKillBar = CurrentBar + 5; this.plotValue = High[2]; } if (CurrentBar == this.entryKillBar + 1) { this.triggerBar = -1; this.entryKillBar = -1; this.mayEnterLong = false; } if (CurrentBar > this.triggerBar && CurrentBar <= this.entryKillBar) { Plot0.Set(this.plotValue); } else { Plot0.Reset(); } } #region Properties [Browsable(false)] [XmlIgnore()] public DataSeries Plot0 { get { return Values[0]; } } #endregion } }
Comment
-
I do not code just to see what happens. I design code to do a specific objective. Therefore, I see little point in writing that code. The issue is not whether it is possible to use multiple plots to provide multiple levels: the issue is that Plots MUST be defined at design time, and so as you do not know at design time how many Plots will be needed, (because future runtime data is indeterminate), there is no way to know how many Plots to predefine.Originally posted by sburtt View Postwhat if in the code you first sent me we add a second plot, structured exactly as plot0, but that is based on the following condition?
if (Low[0] < Low[1] && Low[1] < Low[2] && Low[2] < Low[3])
rather than the condition if (Low[0] < Low[1] && Low[1] < Low[2]) we used for plot0?
How would you code this, I tried but with no success, I would appreciate if you could try this for me if it doesn't take too much time. for simplicity I've attached the code we are working on:
Code:{ #region Variables private int triggerCount = 0; private int triggerBar = -1; private int entryKillBar = -1; private bool mayEnterLong = false; private double plotValue = 0; #endregion protected override void Initialize() { Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "Plot0")); Overlay = true; } protected override void OnBarUpdate() { if (CurrentBar < 2) return; //check Trigger condition this.triggerCount = (Low[0] < Low[1]) ? this.triggerCount + 1 : 0; if (this.triggerCount >= 2) this.mayEnterLong = true; if (this.triggerCount == 2) { this.triggerBar = CurrentBar; this.entryKillBar = CurrentBar + 5; this.plotValue = High[2]; } if (CurrentBar == this.entryKillBar + 1) { this.triggerBar = -1; this.entryKillBar = -1; this.mayEnterLong = false; } if (CurrentBar > this.triggerBar && CurrentBar <= this.entryKillBar) { Plot0.Set(this.plotValue); } else { Plot0.Reset(); } } #region Properties [Browsable(false)] [XmlIgnore()] public DataSeries Plot0 { get { return Values[0]; } } #endregion } }
Once again, instead of looking at the context in which the code will run, it would seem that you are focusing on the single minute detail of whether it is possible to use a second Plot in ONE PARTICULAR scenario, which corresponds to exactly only one runtime scenario. Yes, it is, yet given the context, it is also apropos of nothing.Last edited by koganam; 02-19-2013, 03:50 PM.
Comment
-
I might be wrong, but I am quite sure the answer is the one I stated earlier, we need 5 plots. It's crystal clear in my head what the indicator should do, and you can visually represent this buy testing the code I quoted Today at 02:15 P. The conditions for each of the 5 plots should be:
Plot0
(Low[0] < Low[1] && Low[1] < Low[2])
Plot1
if (Low[0] < Low[1] && Low[1] < Low[2] && Low[2] < Low[3])
Plot2
if (Low[0] < Low[1] && Low[1] < Low[2] && Low[2] < Low[3] && Low[3] < Low[4])
Plot3
if (Low[0] < Low[1] && Low[1] < Low[2] && Low[2] < Low[3] && Low[3] < Low[4] && Low[4] < Low[5])
Plot4
if (Low[0] < Low[1] && Low[1] < Low[2] && Low[2] < Low[3] && Low[3] < Low[4] && Low[4] < Low[5] && Low[5] < Low[6])
If each plot uses "first in progress", if we get an other lower low, at that point plot0 will start printing a new line (as it currently is doing in the code you've sent me) and so on. I think this should work
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
579 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
334 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment