#region Variables private DataSeries crossAboveSeries; #endregion protected override void Initialize() { crossAboveSeries = new DataSeries(this); } protected override void OnBarUpdate() { crossAboveSeries.Set(CrossAbove(Close[0],ParabolicSAR(0.02,0.20,0.02)[0],1)); }
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
Parabolic SAR cross above
Collapse
X
-
Parabolic SAR cross above
I would like to use the stored value at the time that it crosses above the Parabolic SAR, but I'm having problems with that as well as errors in my script. Thanks in advance.
Code:Tags: None
-
Hello,
Thank you for your post.
Currently you are trying to set the data series to a boolvalue. You can set the DataSeries to the Close when the Cross occurs by doing the following:
Code:protected override void() { if(CrossAbove(Close[0],ParabolicSAR(0.02,0.20,0.02)[0],1) { crossAboveSeries.Set(Close[0]); }
Cody B.NinjaTrader Customer Service
-
Hello,
Thank you for the reply.
My apologies you would want to do something like the following example:
Code:protected override void() { if(CrossAbove(Close,ParabolicSAR(0.02,0.20,0.02),1) { crossAboveSeries.Set(Close[0]); }
Cody B.NinjaTrader Customer Service
Comment
-
Thanks again CodyB,
I've also included a sample screenshot and a textfile of the output window.
Based on the screenshot:
at 13:21 Close= 1182.40, but the output window shows 1156.40
at 13:36 Close= 1182.10, output window shows 1137.10
at 14:16 Close= 1181.80, output window shows 1157.40
Code:Print(Time[0].ToString("HH:mm:ss")+" " +crossAboveSeries);
Comment
-
Hello
So that I may assist further can you provide me a copy of the indicator?
You can attach your indicator to your response by going to File > Utilities > Export NinjaScript > Export selected source files > select your Indicator > select the right arrow > Export. The file will be located under (My) Documents\NinjaTrader 7\bin\Custom\ExportNinjaScript.Cody B.NinjaTrader Customer Service
Comment
-
-
Hello,
I have fully reviewed the indicator and I am seeing it is working properly.
You will want to print out the following to verify this.
Code:Print(Time[0].ToString("HH:mm:ss")+" " +crossAboveSeries[0]);
Code:private int myCount = 0 protected override void() if(CrossAbove(Close,ParabolicSAR(0.02,0.20,0.02),1)) { crossAboveSeries.Set(Close[0]); myCount++; DrawDot("dot when cross" + myCount, true, Time[0], crossAboveSeries[0], Color.Pink); }
Cody B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by johnMoss, 03-04-2024, 01:53 PM
|
3 responses
46 views
0 likes
|
Last Post
by AndyM
Today, 06:13 PM
|
||
Started by algospoke, Today, 06:01 PM
|
0 responses
6 views
0 likes
|
Last Post
by algospoke
Today, 06:01 PM
|
||
Started by cre8able, Today, 05:53 PM
|
0 responses
8 views
0 likes
|
Last Post
by cre8able
Today, 05:53 PM
|
||
Started by Wessel, 03-23-2024, 02:37 PM
|
3 responses
23 views
0 likes
|
Last Post Today, 04:58 PM | ||
Started by martini, Yesterday, 04:45 PM
|
4 responses
32 views
0 likes
|
Last Post
by martini
Today, 04:48 PM
|
Comment