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
price of candle going through sma for four candles. is there code for this?
Collapse
X
-
price of candle going through sma for four candles. is there code for this?
i'm trying to code an automated strategy that involves price of a candle running through an sma line. is there logic for this? i'm trying to have price of candle go through sma of low 3 four times. then on fifth candle the whole candle is below the sma. is there code for that? from bars ago it reads the 1st candle is completely below the sma. 2,3,4,5 bars ago price of candle intersects sma.Tags: None
-
Hello SteveReiza,
Thanks for your post.
I am not certain I understand exactly what you want to accomplish based on the information provided.
When you mention "sma of low 3 four times" are you referring to the Low price being less than the SMA indicator plot?
Could you please provide a screenshot demonstrating exactly what you are trying to accomplish so we may accurately assist?- To send a screenshot with Windows 10 or newer I would recommend using the Windows Snipping Tool.
- Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save it as a jpeg file and send the file as an attachment.
Brandon H.NinjaTrader Customer Service
-
thanks for reply. i attached what i was referring to. there is three candles that have a bollinger line go through them. that's what i'd like to code. there is an instance of four candles like this on a keltner channel line that i want to make into a strategy - i scratched the sma idea.
Comment
-
Hello SteveReiza,
Thanks for your notes.
You could check if the Bollinger().Middle[0] plot is less than the High[0] price of the bar and create a condition checking if the Bollinger().Middle[0] plot is greater than the Low[0] price of the bar. This would need to be checked for barsAgo 0, barsAgo 1, and barsAgo 2 to check for 3 bars in a row.
The CountIf() method could be used to accomplish this by surrounding the single condition with (condition1 && condition2).
See this help guide documentation for more information about the CountIf() method and sample code: https://ninjatrader.com/support/help...t8/countif.htm
Bollinger: https://ninjatrader.com/support/help...nger_bands.htmBrandon H.NinjaTrader Customer Service
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by poplagelu, Today, 05:00 AM
|
0 responses
3 views
0 likes
|
Last Post
by poplagelu
Today, 05:00 AM
|
||
Started by fx.practic, 10-15-2013, 12:53 AM
|
5 responses
5,407 views
0 likes
|
Last Post
by Bidder
Today, 12:22 AM
|
||
Started by Shai Samuel, 07-02-2022, 02:46 PM
|
4 responses
98 views
0 likes
|
Last Post
by Bidder
Today, 12:11 AM
|
||
Started by DJ888, Yesterday, 10:57 PM
|
0 responses
8 views
0 likes
|
Last Post
by DJ888
Yesterday, 10:57 PM
|
||
Started by MacDad, 02-25-2024, 11:48 PM
|
7 responses
160 views
0 likes
|
Last Post Yesterday, 10:23 PM |
Comment