![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Dec 2007
Location: Poland
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
|
Hi, my name is Wiktor and I come from Poland
) my grammar english is not really impressive. i'm begginer trader and i try write my first indicator.When i write : protected override void Initialize() { Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0")); CalculateOnBarClose = false; Overlay = true; PriceTypeSupported = true; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { // Condition set 1 kupuj if ( Close[0] > MAX(High, 2)[0] ) { DrawArrowUp("My up arrow" + CurrentBar, 0, Low[0] +- 5 * TickSize, Color.Blue); DrawLine("My line" + CurrentBar, 0, Low[0],35, Low[0], Color.Blue); } I would like trade Long when price breakout MAX from 2 bars, but that indicator don't plot on chart, where is bug ?? What I write wrong ?? Help me |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
Yek shamash! (my spelling is probably bad as well but hopefully you know what I mean)
The problem is with your logic. Your condition will !never be true since the close will !never be greater than the highest highest high of the last two bars. At best, it may equal. What you likely want to check for is if the current bar close is greater than the highest high of the past two bars excluding the current bar. if (Close[0] > MAX(High, 2)[1]) // Do something is what you want. You will also want to add a check like this before hand. if (CurrentBar < 1) return; See this link for more info - http://www.ninjatrader-support.com/v...ead.php?t=3170
Ray
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Start/End of day plot | Mexie | Indicator Development | 20 | 08-04-2011 09:24 PM |
| Variable plot within chart? | Burga1 | Charting | 9 | 12-02-2007 08:20 PM |
| Limiting a Plot | rt-trader | General Programming | 2 | 08-25-2007 06:21 PM |
| Hiding a plot | grd974 | Indicator Development | 5 | 05-28-2007 01:47 PM |
| Chart Trader vs Plot Executions | LG | Charting | 1 | 04-27-2007 02:24 AM |