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
avoid crossing over line drawn by strategy
Collapse
X
-
avoid crossing over line drawn by strategy
Hello, my strategy draws a line from one set point to another within the momentum indicator. On this amount of candles I already have a series that keeps the momentum, what I want is that if there is any crossing above or below, depending on whether it is red or green, of the line that draws my strategy, do not enter. My problem is that I can't get the double of the line. I would like to know if, just as it is given a name "lineX" that marks the entire line, I can obtain a double value over the entire series of the "lineX"Tags: None
-
what I want is the momentum1 of a series of example bars; bar 2 to bar 12, is less than the line drawn by the strategy within the same series of bars, if this is different, do not execute the strategy
my series of bars would be this;
Series<double> divmom = new Series<double>(this, MaximumBarsLookBack.TwoHundredFiftySix);
for(int i = 2; i < 12 && i < Momentum1.Count && Momentum1[i] != null; i++)
{
divmom[i] = Momentum1[i];
}
for(int i = 0; i < 2; i++) {
divmom[i] = Double.MaxValue;
}
and there is the line;
Draw.Line(Momentum1, @"LineMom", false, 12, Momentum1[12], 0, Momentum1[2], Brushes.Green, DashStyleHelper.Solid, 1);
Comment
-
Hello RubenCazorla,
When you say less than the line '...the momentum1... ...is less than the line drawn...' . What if the line has two anchors at different prices (drawn diagonally)? Will the line always be horizonal?
What do you consider less than that line? Less than the first anchor of the line? Less than the second anchor of the line? Less than the y-intercept of the line on a bar between the two points?
Is the code you have suggested the code you want?
The code you have suggested does not appear to check if the divmom[0] is less than the line.
Where are you getting stuck?
Do you have code comparing the momentum1 to the line?Chelsea B.NinjaTrader Customer Service
Comment
-
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by johntraderuser2, Today, 02:34 AM
|
0 responses
6 views
0 likes
|
Last Post Today, 02:34 AM | ||
Started by IanS00, 03-27-2024, 11:24 AM
|
2 responses
12 views
0 likes
|
Last Post Today, 02:00 AM | ||
Started by Mariawilcoxi, Today, 01:32 AM
|
0 responses
4 views
0 likes
|
Last Post
by Mariawilcoxi
Today, 01:32 AM
|
||
Started by gleichnerany, Today, 01:17 AM
|
0 responses
5 views
0 likes
|
Last Post
by gleichnerany
Today, 01:17 AM
|
||
Started by WHICKED, 03-27-2024, 12:33 PM
|
4 responses
46 views
0 likes
|
Last Post Today, 12:28 AM |
Comment