Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to generate a signal when price crosses high of the previous bar
Collapse
X
-
How to generate a signal when price crosses high of the previous bar
Please advise how to generate a signal when price crosses high of the previous bar. I cannot find the last price in the wizard. Tried to backtest with (Bid >= High[1]) - it don`t work okay. Please advise.
Tags: None
-
vitaleg, in that case, you will have to do something like this:
The above code basically says: if the most recent close is above the previous bar's high, and the current bar's open is below the previous bar's high, then do something.Code:if (Close[0] > High[1] && Open[0] < Close[1]) // show alert or something
AustinNinjaTrader Customer Service
Comment
-
One more question. I`ve tried to program strategy to trig when last price is higher than High[1] + 0.02$ But it doesn`t work correctly on backtesting - sometimes it enter correctly, sometimes no. I have the following code:you can access the last price by using the Close variable
Close[0] > (High[1] + 0.02)
Comment
-
Which instrument are you working on as this happens? I suggest to add some drawings to visually see when an entry should be triggered according to your programmed rules -
Also please keep in mind the order will be placed on the next bar, since this the earliest possible trade location in backtesting.
Comment
-
Hi, I have a similar issue in NT6.5....
I am trying something very very simple as I am new to the programming here but clearly am missing something.
I basically just added to a new Wizard generated indicator, after the OnBarUpdate()...
if (Close[0]<Close[2])
DrawSquare("tag1"+CurrentBar, true, 0, Low[0] - TickSize, Color.Blue);
But nothing shows...?
thanks.Last edited by Adina; 08-19-2010, 05:50 AM.
Comment
-
Adina, you likely miss this check at your OnBarUpdate() start - http://www.ninjatrader.com/support/f...ead.php?t=3170
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
571 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
331 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
549 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
549 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment