NexusFi: Find Your Edge


Home Menu

 





Double MA and Triple MA Script


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Sadboybh with 3 posts (0 thanks)
    2. looks_two Big Mike with 2 posts (1 thanks)
    3. looks_3 cory with 2 posts (0 thanks)
    4. looks_4 RJay with 1 posts (1 thanks)
    1. trending_up 3,826 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 8 posts
    2. attach_file 0 attachments




 
Search this Thread

Double MA and Triple MA Script

  #1 (permalink)
Sadboybh
Bahrain
 
Posts: 12 since May 2011
Thanks Given: 4
Thanks Received: 0

Hi guys,
I am trying to make a script that consists of 2 original SMA indicators , I tried so many ways to duplicate the original but it didn't work out for me..

I would highly appreciate it if someone can tell me how to make a double or triple version of the original SMA.

one more thing: Can I set the value of one SMA to CalculateOnBarClose = false, and the other one to CalculateOnBarClose = true !!!

Thanks...

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Cheap historycal L1 data for stocks
Stocks and ETFs
Trade idea based off three indicators.
Traders Hideout
ZombieSqueeze
Platforms and Indicators
Better Renko Gaps
The Elite Circle
How to apply profiles
Traders Hideout
 
  #3 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090


is this NT7? just specify MA of MA of MA you don't need any script.

Reply With Quote
  #4 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,464 since Jun 2009
Thanks Given: 33,242
Thanks Received: 101,662


Sadboybh View Post
I would highly appreciate it if someone can tell me how to make a double or triple version of the original SMA.

 
Code
                            
#init

private double dsma;

#onbarupdate
dsma SMA(SMA(Close20), 100); 
Will give you a double sma.


Quoting 
one more thing: Can I set the value of one SMA to CalculateOnBarClose = false, and the other one to CalculateOnBarClose = true !!!

No.

Mike



Join the free Markets Chat beta: one platform, all the trade rooms!

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #5 (permalink)
Sadboybh
Bahrain
 
Posts: 12 since May 2011
Thanks Given: 4
Thanks Received: 0


Big Mike View Post
 
Code
                            
#init
private double dsma;

#onbarupdate
dsma SMA(SMA(Close20), 100); 
Will give you a double sma.



No.

Mike

thank you mike,
but if i set the previous code, how will i be able to customize each plots characteristics, for example if i wanna add a condition that changes the 20SMA color when it crosses above the 100SMA !!

if both SMAs has one defined variable which is private double dsma, how will i be able to change each SMA's separately ? what's the unique definition for the 20SMA ? and whats is for the 100SMA ?

thanks in advance

Reply With Quote
  #6 (permalink)
Sadboybh
Bahrain
 
Posts: 12 since May 2011
Thanks Given: 4
Thanks Received: 0

plus it keeps on telling me that cannot convert ninjatrader.type.indicator.SMA to double !!!!


any other thoughts bro ?

Reply With Quote
  #7 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,464 since Jun 2009
Thanks Given: 33,242
Thanks Received: 101,662


Sadboybh View Post
plus it keeps on telling me that cannot convert ninjatrader.type.indicator.SMA to double !!!!


any other thoughts bro ?

Type-o in my code. I haven't used NT in 18 months, give me a small break Add [0] to end to reference DataSeries.

 
Code
                            
dsma SMA(SMA(Close20), 100)[0]; 



Sadboybh View Post
thank you mike,
but if i set the previous code, how will i be able to customize each plots characteristics, for example if i wanna add a condition that changes the 20SMA color when it crosses above the 100SMA !!

if both SMAs has one defined variable which is private double dsma, how will i be able to change each SMA's separately ? what's the unique definition for the 20SMA ? and whats is for the 100SMA ?

thanks in advance

Try watching @sam028's basic intro webinar on NT programming which covers multi color plots:


And/or @shodson's NT webinar which gives you the basic building blocks of C#:


Or look at any one of the hundreds of indicators on nexusfi.com (formerly BMT) that have multicolor plots and look at the code and learn. Try also buying some C# books to get you started.

Mike



Join the free Markets Chat beta: one platform, all the trade rooms!

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #8 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090

or search for double or triple
https://nexusfi.com/search/attachments/

Reply With Quote
  #9 (permalink)
 
RJay's Avatar
 RJay 
Hartford, CT. USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: RTY
Posts: 683 since Jun 2009
Thanks Given: 758
Thanks Received: 787

or just look at NT's TRIX indicator for code on building a triple MA.

Reply With Quote
Thanked by:




Last Updated on June 17, 2011


© 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