NexusFi: Find Your Edge


Home Menu

 





DoubleMA strategy error


Discussion in NinjaTrader

Updated
    1. trending_up 4,029 views
    2. thumb_up 1 thanks given
    3. group 0 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
dsraider
New York, NY
 
Posts: 142 since Dec 2009
Thanks Given: 41
Thanks Received: 87

Hey All,

I'm trying to write a strategy that enters long when DoubleMA (5 HMA, 45 VMA) is rising (blue) and SuperTrend (3, VMA, 1.23, 3, ATR) is rising as well. Will short the opposite as well. NT, however, is not cooperating and I get the following error messages:

'NinjaTrader.Strategy.Strategy.TSSuperTrend(int, TSSuperTrend.Utility.MovingAverageType. double, int, TSSuperTrend.Utility.SuperTrendMode)' is a 'method' which is not valid in the given context

AND

'NinjaTrader.Indicator.Mav' is a 'type', which is not vaild in the given context

When I tried to doing this through the wizard, (DoubleMA on the left, == in the middle and "Rising" on the right OR DoubleMA rising == true OR DoubleMA > DoubleMA bars ago 1) I get this error message:

Return type of left expression 'DoubleMA' and right expression 'Boolean' do not match. You need to select a different item.

Why does Ninja hate me?

Thanks - Dave


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trump Truth Social Fires Hormuz From 10% to 59% -- Arsen …
Prediction Markets & Event Contracts
Day 96 Missiles Hit Kuwait and Bahrain: June 15 Peace at …
Prediction Markets & Event Contracts
Thursday May 28: GDP + Core PCE + Jobless Claims All at …
Traders Hideout
Fed Hike Odds at 57% After Warsh: England Surges 12.9%, …
Prediction Markets & Event Contracts
Warsh Rate Hike at 40%, Iran June 15 Expires Tonight at …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
8 thanks
Darmok and Jalad at Tanagra
1 thanks
  #2 (permalink)
 
RJay's Avatar
 RJay 
Hartford, CT. USA
 Vendor: www.innovative-trading-solutions-online.com 
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: ES
Posts: 687 since Jun 2009
Thanks Given: 765
Thanks Received: 789


dsraider View Post
Hey All,

I'm trying to write a strategy that enters long when DoubleMA (5 HMA, 45 VMA) is rising (blue) and SuperTrend (3, VMA, 1.23, 3, ATR) is rising as well. Will short the opposite as well. NT, however, is not cooperating and I get the following error messages:

'NinjaTrader.Strategy.Strategy.TSSuperTrend(int, TSSuperTrend.Utility.MovingAverageType. double, int, TSSuperTrend.Utility.SuperTrendMode)' is a 'method' which is not valid in the given context

AND

'NinjaTrader.Indicator.Mav' is a 'type', which is not vaild in the given context

When I tried to doing this through the wizard, (DoubleMA on the left, == in the middle and "Rising" on the right OR DoubleMA rising == true OR DoubleMA > DoubleMA bars ago 1) I get this error message:

Return type of left expression 'DoubleMA' and right expression 'Boolean' do not match. You need to select a different item.

Why does Ninja hate me?

Thanks - Dave

Hi Dave,

For the DoubleMA issue, DoubleMA has the following code:

if (Signal[0] == 1)
dmv.Set(RisingPlot[0]);
if (Signal[0] == -1)
dmv.Set(FallingPlot[0]);
if (Signal[0] == 0)
dmv.Set(NeutralPlot[0]);

Create 3 user defined inputs in the strategy, call them Rising, Falling, and Neutral. Give them the the 1, 0, -1 values.

Now you are using apples and apples!!!

With DoubleMA plot option on the left side set to signal, use == to user defined variables Rising, Falling, and Neutral on the right side.

Left and right sides will now agree and compile.

I hope this helps,

RJay


Reply With Quote
  #3 (permalink)
dsraider
New York, NY
 
Posts: 142 since Dec 2009
Thanks Given: 41
Thanks Received: 87


RJay,

Thanks for responding. Pretend, though, that I am a complete idiot when it comes to NinjaScript (pretend = I really am)

I followed your instuctions as follows:

Name = Rising, Type = int, Default = 1, Min = 1, Description = Rising DoubleMA (added your conditions for falling and neutral as well). After that, I added DoubleMA to the left (5 HMA, 45 VMA, signal), == in the middle and "rising" to the left. Got the same 'Boolean' error message.

Did I miss something?

Thanks


Reply With Quote
  #4 (permalink)
 
RJay's Avatar
 RJay 
Hartford, CT. USA
 Vendor: www.innovative-trading-solutions-online.com 
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: ES
Posts: 687 since Jun 2009
Thanks Given: 765
Thanks Received: 789


dsraider View Post
RJay,

Thanks for responding. Pretend, though, that I am a complete idiot when it comes to NinjaScript (pretend = I really am)

I followed your instuctions as follows:

Name = Rising, Type = int, Default = 1, Min = 1, Description = Rising DoubleMA (added your conditions for falling and neutral as well). After that, I added DoubleMA to the left (5 HMA, 45 VMA, signal), == in the middle and "rising" to the left. Got the same 'Boolean' error message.

Did I miss something?

Thanks

dsraider,

Your getting there. each indicator requires an "if" condition. First line built in the prior post determines the direction of the DoubleMA indicator.

HMA and VMA have decimal style outputs. rising and falling can be determined by looking at the prior bar.

Set conditions:

if HMA[1] > HMA[0] (This means if its falling condition)

if HMA[1] < HMA[0] (This means if its rising condition)

The same is true for VMA.


You set one condition for each indicator for a total of three for each "set".

When all three are true, program will execute the "Do the following command" for that set.

RJay


Reply With Quote
Thanked by:
  #5 (permalink)
dsraider
New York, NY
 
Posts: 142 since Dec 2009
Thanks Given: 41
Thanks Received: 87

I wish I could say that helped but I felt smarter before this post I assume this means I will need to code directly and can't use the wizard for all of this?

By the way, I used to live in Hartford. You're not a fellow UHA grad, are you? If so, well then, I'm sorry...


Reply With Quote
  #6 (permalink)
dsraider
New York, NY
 
Posts: 142 since Dec 2009
Thanks Given: 41
Thanks Received: 87

If anyone here has used TSsupertrend in a strategy, could you please, for the love of everything holy, PM me or post an existing cs file to this thread? I would greatly appreciate it, as would the last remaining hairs in my head.

Thanks in advance,
Dave


Reply With Quote




Last Updated on January 25, 2010


© 2026 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 - Downloads - Top
no new posts