NexusFi: Find Your Edge


Home Menu

 





Single line script translate please~~


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Fat Tails with 4 posts (2 thanks)
    2. looks_two KFurious with 3 posts (0 thanks)
    3. looks_3 zeller4 with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 3,514 views
    2. thumb_up 2 thanks given
    3. group 3 followers
    1. forum 7 posts
    2. attach_file 2 attachments




 
Search this Thread

Single line script translate please~~

  #1 (permalink)
KFurious
Hong Kong
 
Posts: 3 since Jan 2011
Thanks Given: 2
Thanks Received: 0

Hi there, could anybody transcript this single code for me plz? I'm not a programmer and the only programming language I can do is Metastock language...seems got a really big difference with it....ouch....

H-L>Mov(H-L,10,S)*2

Thank you very much~~

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
ZombieSqueeze
Platforms and Indicators
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
60 thanks
Funded Trader platforms
43 thanks
NexusFi site changelog and issues/problem reporting
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
19 thanks
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102



KFurious View Post
Hi there, could anybody transcript this single code for me plz? I'm not a programmer and the only programming language I can do is Metastock language...seems got a really big difference with it....ouch....

H-L>Mov(H-L,10,S)*2

Thank you very much~~


This is the NinjaTrader code:

 
Code
High[0]-Low[0] > 2 * (SMA(High,10)[0] - SMA(Low,10)[0]);

Reply With Quote
Thanked by:
  #4 (permalink)
KFurious
Hong Kong
 
Posts: 3 since Jan 2011
Thanks Given: 2
Thanks Received: 0

Thanks a lot Fat Tails~

Would you also tell me how can I make it just valid if the last bar's signal = false?

In Metastock, I just write like this...

Signal and ref(Signal,-1)=false

Thank you~~

Reply With Quote
  #5 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


KFurious View Post
Thanks a lot Fat Tails~

Would you also tell me how can I make it just valid if the last bar's signal = false?

In Metastock, I just write like this...

Signal and ref(Signal,-1)=false

Thank you~~

NinjaTrader references the CurrentBar with [0], if you want to reference the previous bar, you would use [1]. The code would therefore be

 
Code
if (High[0]-Low[1] > 2 * (SMA(High,10)[1] - SMA(Low,10)[1]))
You can also print out the NinjaTrader help file (900 pages), you will find everything needed.

Reply With Quote
Thanked by:
  #6 (permalink)
KFurious
Hong Kong
 
Posts: 3 since Jan 2011
Thanks Given: 2
Thanks Received: 0

Thanks again Fat Tails, would you suggest any tutorial or ebook which cover more in details about NT programming?

Or should I learn C# first before that?

Reply With Quote
  #7 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


KFurious View Post
Thanks again Fat Tails, would you suggest any tutorial or ebook which cover more in details about NT programming?

Or should I learn C# first before that?

I would suggest to dig through a book, something like "C# in 20 days". Then just copy and paste code from existing indicators and use the NinjaScript reference. That should do.

Reply With Quote
  #8 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 477 since Jun 2009
Thanks Given: 1,416
Thanks Received: 404

Hello,
This is from a "Volume Momentum" Indicator from Barbara Star:


Quoting 
Barbara Star discusses volume variations. The title of the article is: Volume Variations.

Mov(ROC(Cum(If(C>(H+L)/2,V,If(C<(H+L)/2,-V,0))),12,$),10,S)

I'm not sure how to do the Cumulative portion of the formula. I'm also not sure about the "$".

Here's my attempt.
 
Code
//variables:
private int			emaperiod = 10;
		private int			rocperiod = 12;
		private DataSeries	_rocvol;
		

//Mov(ROC((Cum(If(C>(H+L)/2,V, If(C<(H+L)/2,-V,0)))),12,$),10,S)
bool aboveMid = (Close[0]>(High[0]+Low[0])/2);
bool belowMid = (Close[0]<(High[0]+Low[0])/2);

_rocvol.Set(aboveMid ? ROC(Volume,rocperiod)[0] : 
			belowMid ? -1*ROC(Volume,rocperiod)[0] : 0);
			
VolMom.Set(EMA(_rocvol,emaperiod)[0]);
Not sure what the end result would look like but I posted a screenshot of mine...

p.s., is there a MetaStock resource library for Ninjascript porting?

Attached Thumbnails
Click image for larger version

Name:	CL 11-15 (4 UniRenko T4R14O7)  10_7_2015.jpg
Views:	216
Size:	61.3 KB
ID:	194731  
Attached Files
Elite Membership required to download: VolumeMomentum_v01.cs
Reply With Quote




Last Updated on October 7, 2015


© 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