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
Low price in time range
Collapse
X
-
Gotcha. If I'm looking at futures and have my entries starting at 930am but I have a condition looking at the low of the bar from 830-930am it's not gonna give me any trades is it? Because it's previous to my entry cutoff and doesn't meet min bars required. Or if not there must be another reason I'm getting 0 trades.
Comment
-
It's ES. Primary is 1min and I have all the added series below. Bar checks are below. I changed minLookback to sigBarlow. And I took out MIN and just made it double sigBarlow = Lows[4][0]; seeing I'm only looking at 1 bar. I was getting a lot of trades previous but with adding
if(ToTime(Time[0]) == 93100)
{
double sigBarlow = Lows[4][0];
}
I'm not getting any trades....
Code:public class FuturesNew1130 : Strategy { #region Variables private double sigBarlow = 0; #endregion protected override void Initialize() { //Primary 40min //1min Add("ES ##-##",PeriodType.Minute, 5); //Index 1 //10min Add("ES ##-##",PeriodType.Minute, 10); //Index 2 //30min Add("ES ##-##",PeriodType.Minute, 20); //Index 3 //Hour Add("ES ##-##",PeriodType.Minute, 60); //Index 4 //Day Add("ES ##-##",PeriodType.Minute, 150); //Index 5 CalculateOnBarClose = true; EntriesPerDirection = 1; SetStopLoss("EnterShort", CalculationMode.Ticks, 85, true); SetProfitTarget("EnterShort",CalculationMode.Ticks, 80); } protected override void OnBarUpdate() { //Entry Conditions if(ToTime(Time[0]) == 93100) { double sigBarlow = Lows[4][0]; } if ((BarsInProgress == 3) && (BarsSinceEntry(0,"",0) > 40 || BarsSinceExit(0,"",0)==-1) && (CurrentBars[0] >= 2) //1min && (CurrentBars[2] >= 2) //10min && (CurrentBars[3] >= 1) //20min && (CurrentBars[4] >= 2) //600min && Volume[0] > 80000 && Volume[0] > Volume[1]) { if(ToTime(Time[0]) >= 93000 && ToTime(Time[0]) <= 110000 && Opens[0][0] - Closes[0][0] <= 3.25 && Close[0] < Open[0] - 1.25 && Falling(SMA(BarsArray[0], 190)) && Closes[0][0] < SMA(BarsArray[0], 190)[0] && Closes[0][0] < SMA(BarsArray[0], 65)[0] && Closes[0][0] < sigBarlow && ATR(BarsArray[4], 14)[0] > 4 && Close[0] < PriorDayOHLC().PriorHigh[0]) { EnterShort(0, 1, "EnterShort"); Print(sigBarlow + "sigBarlow"); } } //ShortExit if((BarsInProgress == 2) && Position.MarketPosition == MarketPosition.Short && Closes[0][0] < Position.AvgPrice - (TickSize*15) && Close[0] > Open[0] + 2.5) { ExitShort(0, 1, "UpCandle", "EnterShort"); } if (Position.MarketPosition == MarketPosition.Short && ToTime(Time[0]) >= 113000) { ExitShort(0, 1, "ExitTime", "EnterShort"); } if ((BarsInProgress == 1) && Position.MarketPosition == MarketPosition.Short && CrossAbove(SMA(13), SMA(38), 1))//13&38 { ExitShort(0, 1, "SMAExit", "EnterShort"); } if((BarsInProgress == 0) && Position.MarketPosition == MarketPosition.Short && BarsSinceEntry(0, "", 0) <= 20 && Closes[0][0] < Position.AvgPrice - (TickSize*26))// { ExitShort(0, 1, "TimeCutS", "EnterShort"); } }
Comment
-
I don't know I think that statement is doing something strange like only allowing trades at 930 exactly. I'm just going to use this statement below, although long, I'm comfortable it's doing what I intend. My entry time is between 930 and 11, so depending on what time it is I'm checking for the current price to be below the low of 830-930 bar. My index 4 is a 60min bar and index 3 is a 30min bar...
If (ToTime(Time[0]) > 93000 && ToTime(Time[0]) <= 100000 && Closes[0][0] < Lows[4][0]
|| ToTime(Time[0]) > 100000 && ToTime(Time[0]) <= 103000 && Closes[0][0] < Lows[3][1]
&& Closes[0][0] < Lows[3][2]
|| ToTime(Time[0]) > 103000 && ToTime(Time[0]) <= 110000 && Closes[0][0] < Lows[4][1]))
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Tburg1073, Today, 08:36 AM
|
0 responses
2 views
0 likes
|
Last Post
by Tburg1073
Today, 08:36 AM
|
||
Started by alexstox, 10-16-2018, 03:29 PM
|
10 responses
333 views
0 likes
|
Last Post
by Tburg1073
Today, 08:32 AM
|
||
Started by smartromain, 03-13-2024, 01:42 AM
|
6 responses
98 views
0 likes
|
Last Post
by smartromain
Today, 08:30 AM
|
||
Started by Jonker, 04-27-2024, 01:19 PM
|
4 responses
29 views
0 likes
|
Last Post
by Jonker
Today, 08:26 AM
|
||
Started by Yasharandom, Today, 07:45 AM
|
0 responses
5 views
0 likes
|
Last Post
by Yasharandom
Today, 07:45 AM
|
Comment