NexusFi: Find Your Edge


Home Menu

 





EasyLanguage to NinjaScript - example


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
tomas262
Ostrava, Czech Republic
 
Posts: 97 since May 2013
Thanks Given: 19
Thanks Received: 38

Hi traders,

I am struggling with conversion of EasyLanguage code to NinjaScript especially with part where it should calculate indicator values. Here is the EL piece of code:

 
Code
VarL1 = AccumDist(Ticks);
VarL2 = AccumDist(Ticks)[Shift1];
VarL3 = XAverage(VarL2, N1);
VarL4 = WAverage(VarL3, N2)[Shift2];
VarL5 = XAverage(VarL4, N3);
EntCondL = VarL1 < VarL5;
I tried to retype it into C# version

 
Code
if (ADL(Volume)[0] < EMA(WMA(EMA(ADL(Volume)[Shift1], N1), N2)[Shift2], N3)[0] ) EntCondL = true;
As a C# beginner I quite understand why it does not work in C#. EMA(ADL(Volume)[Shift1], N1) uses for calculation only a single value of ADL(Volume) at bar [Shift1]. But I don't understand then how EL can calculate XAverage (VarL3) using a single value of ADL instead of "array of values of ADL"

Any help on logic difference between EL and NS(C#) would be much appreciated

Thanks

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Elite Trader Funding, Avoid?
Trading Reviews and Vendors
tick data interval discrepancy
NinjaTrader
STRATEGY on MC crossEMA
The Elite Circle
Downloading NinjaTrader Market Replay Data: Multi-part D …
NinjaTrader
MC PL editor upgrade
MultiCharts
 
  #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



tomas262 View Post
Hi traders,

I am struggling with conversion of EasyLanguage code to NinjaScript especially with part where it should calculate indicator values. Here is the EL piece of code:

 
Code
VarL1 = AccumDist(Ticks);
VarL2 = AccumDist(Ticks)[Shift1];
VarL3 = XAverage(VarL2, N1);
VarL4 = WAverage(VarL3, N2)[Shift2];
VarL5 = XAverage(VarL4, N3);
EntCondL = VarL1 < VarL5;
.....

Thanks

maybe something like this? Disclaimer: I know nothing about EL.


...given VarL1 tp VarL5 are all dataseries.

VarL1.Set(OBV[0]);
VarL2.Set(OBV[1]); // OBV 1 back
VarL3.Set( EMA (VarL2, N1)[0]);
VarL4.Set( WMA(VarL3, N2)[2]); // 2 back??? not sure
VarL5.Set( EMA(VarL4, N3)[0]);

some sample

Reply With Quote
Thanked by:




Last Updated on July 10, 2013


© 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