NexusFi: Find Your Edge


Home Menu

 





DoubleMA strategy error


Discussion in NinjaTrader

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




 
Search this Thread

DoubleMA strategy error

  #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?
NexusFi Journal Challenge - April 2024
Feedback and Announcements
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Request for MACD with option to use different MAs for fa …
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Retail Trading As An Industry
58 thanks
Battlestations: Show us your trading desks!
55 thanks
NexusFi site changelog and issues/problem reporting
48 thanks
What percentage per day is possible? [Poll]
31 thanks
GFIs1 1 DAX trade per day journal
29 thanks

  #2 (permalink)
 
RJay's Avatar
 RJay 
Hartford, CT. USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: RTY
Posts: 682 since Jun 2009
Thanks Given: 756
Thanks Received: 787


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
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: RTY
Posts: 682 since Jun 2009
Thanks Given: 756
Thanks Received: 787


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
The following user says Thank You to RJay for this post:
  #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


© 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