NexusFi: Find Your Edge


Home Menu

 





Ninjascript MRO usage?


Discussion in NinjaTrader

Updated
    1. trending_up 1,278 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 6 posts
    2. attach_file 2 attachments




 
Search this Thread

Ninjascript MRO usage?

  #1 (permalink)
 Tradarr 
Atlanta Ga. USA
 
Experience: Intermediate
Platform: NT8,ThinkorSwim,
Trading: Grains
Posts: 341 since Mar 2017
Thanks Given: 86
Thanks Received: 88

Anyone have a clue on using NinjaScript MRO function to reference plots or examples other than in the NinjaScript 8 documentation?

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Quant vue
Trading Reviews and Vendors
Cheap historycal L1 data for stocks
Stocks and ETFs
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
What is Markets Chat (markets.chat) real-time trading ro …
75 thanks
Spoo-nalysis ES e-mini futures S&P 500
55 thanks
Just another trading journal: PA, Wyckoff & Trends
31 thanks
Bigger Wins or Fewer Losses?
24 thanks
The Program
16 thanks
  #2 (permalink)
 
jimboulder's Avatar
 jimboulder 
Erie,CO
 
Experience: Advanced
Platform: NinjaTrader
Broker: NinjaTrader Brokers, CQG Data Feed
Trading: ES, Crude and Options
Posts: 4 since Mar 2010
Thanks Given: 0
Thanks Received: 2

I’ve had some experience with it, is there a specific “condition” you’re trying to track ?

Reply With Quote
  #3 (permalink)
 Tradarr 
Atlanta Ga. USA
 
Experience: Intermediate
Platform: NT8,ThinkorSwim,
Trading: Grains
Posts: 341 since Mar 2017
Thanks Given: 86
Thanks Received: 88



jimboulder View Post
I’ve had some experience with it, is there a specific “condition” you’re trying to track ?

I am using the VPA indicator, I want to reference a divergence plot I have added , I want a new plot that seeks a divergence within 5 bars and now a moving average crossover.

Started this thread Reply With Quote
  #4 (permalink)
 Tradarr 
Atlanta Ga. USA
 
Experience: Intermediate
Platform: NT8,ThinkorSwim,
Trading: Grains
Posts: 341 since Mar 2017
Thanks Given: 86
Thanks Received: 88


jimboulder View Post
I’ve had some experience with it, is there a specific “condition” you’re trying to track ?

Getting error below when trying to use MRO for referencing a condition :

The best overloaded method match for 'NinjaTrader.NinjaScript.NinjaScriptBase.MRO(Syste m.Func<bool>, int, int)' has some invalid arguments
Argument 1: cannot convert from 'bool' to 'System.Func<bool>'

DvgBullTrigger = (MRO(RSIPosDvg,1,20) && CrossAbove(EMA(8),EMA(21),1) && Volume[0] > volumeSma[0]);

Trying to add divergence breakout plots to the open source VPA new version, tried using MRO as in User Guide and this way with no success , any pointers/fixes greatly appreciated.

Started this thread Reply With Quote
  #5 (permalink)
 
jimboulder's Avatar
 jimboulder 
Erie,CO
 
Experience: Advanced
Platform: NinjaTrader
Broker: NinjaTrader Brokers, CQG Data Feed
Trading: ES, Crude and Options
Posts: 4 since Mar 2010
Thanks Given: 0
Thanks Received: 2

So MRO returns a int value of the number of bars ago the specific condition happened within the lookback. Note MRO always starts with the CurrentBar and works backward through the lookback, so in your code it is looking back 21 bars-including the currentbar.

If the condition did NOT occur within the lookback, it returns a -1, it DID occur it will return the #barsago it most recently occurred (since the 2nd parameter is a 1)

So first question is what kind of variable is RSIPosDvg? Is true or false, or a numeric, or ??

For the MRO to work, the expression must be in the form of a condition that is true of false. If it is numeric, we just have to express it in the MRO as a condition that it can resolve to true or false.

Second, to use MRO in this situation, you also must express the MRO in terms of its return value of -1, or n# barsago most recently the condition was true (the "1" in the second parameter means most recent, 2 would be the 2nd most recent, etc.

So, in your code, I assume you want the RSIPosDvg "condition" to have occurred at least once in the CurrentBar + 20 prior bars, so check that it didn't eval to a "-1" (any positive return value means it DID occur)


try this

DvgBullTrigger = (MRO(RSIPosDvg,1,20) != -1 && CrossAbove(EMA(8),EMA(21),1) && Volume[0] > volumeSma[0]);


Let me know if this is what you are looking for...if not, we can adjust it.

Reply With Quote
Thanked by:
  #6 (permalink)
 Tradarr 
Atlanta Ga. USA
 
Experience: Intermediate
Platform: NT8,ThinkorSwim,
Trading: Grains
Posts: 341 since Mar 2017
Thanks Given: 86
Thanks Received: 88


jimboulder View Post
So MRO returns a int value of the number of bars ago the specific condition happened within the lookback. Note MRO always starts with the CurrentBar and works backward through the lookback, so in your code it is looking back 21 bars-including the currentbar.

If the condition did NOT occur within the lookback, it returns a -1, it DID occur it will return the #barsago it most recently occurred (since the 2nd parameter is a 1)

So first question is what kind of variable is RSIPosDvg? Is true or false, or a numeric, or ??

For the MRO to work, the expression must be in the form of a condition that is true of false. If it is numeric, we just have to express it in the MRO as a condition that it can resolve to true or false.

Second, to use MRO in this situation, you also must express the MRO in terms of its return value of -1, or n# barsago most recently the condition was true (the "1" in the second parameter means most recent, 2 would be the 2nd most recent, etc.

So, in your code, I assume you want the RSIPosDvg "condition" to have occurred at least once in the CurrentBar + 20 prior bars, so check that it didn't eval to a "-1" (any positive return value means it DID occur)


try this

DvgBullTrigger = (MRO(RSIPosDvg,1,20) != -1 && CrossAbove(EMA(8),EMA(21),1) && Volume[0] > volumeSma[0]);


Let me know if this is what you are looking for...if not, we can adjust it.

Thanks! Attached is what I have so far, it has over 100 plots/alerts to choose from, I added my interpretation of Bag Holding and End Of A Rising market, the divergence breakout section has not been corrected yet, I plan to add the Bollinger W , V, M, and A top/bottom formation alerts before sharing to the downloads section.

Attached Files
Elite Membership required to download: VPAassistant.cs
Started this thread Reply With Quote
  #7 (permalink)
 Tradarr 
Atlanta Ga. USA
 
Experience: Intermediate
Platform: NT8,ThinkorSwim,
Trading: Grains
Posts: 341 since Mar 2017
Thanks Given: 86
Thanks Received: 88


Tradarr View Post
Thanks! Attached is what I have so far, it has over 100 plots/alerts to choose from, I added my interpretation of Bag Holding and End Of A Rising market, the divergence breakout section has not been corrected yet, I plan to add the Bollinger W , V, M, and A top/bottom formation alerts before sharing to the downloads section.

I am still getting errors on the compile so I have commented out the for plots using MRO:
1.DvgBullBreak
2.DvgBearbreak
3.FryPanBottom
4.DumplingTop

I was trying to export the file but now getting errors doing that, attached is completed with added W,M,A,V, formations too.

Attached Files
Elite Membership required to download: VPAassistant.cs
Started this thread Reply With Quote




Last Updated on August 13, 2021


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts