NexusFi: Find Your Edge


Home Menu

 





Converting Multicharts variables to NinjaTrader


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
jjsshh
Helsinki, Finland
 
Posts: 23 since Dec 2013
Thanks Given: 14
Thanks Received: 4

Hi,
I have a hard time to convert ELA indicators that are using loops to NT. The problem is that NT cannot use arrays similar ways ELA language is able to do. Here is an example of what I am trying to convert to NT (for loop is the problem):

inputs:
depth = 10;

Array:
iprice = close;
pBuffer[30](0);
price = iprice;
summ=0;

for x=0 to depth-1
begin
pbuffer[x] = price;
price = (pbuffer[x] + pbuffer[x][1])/2.0;
summ+= price;
end;

I first came up with NT code like this:

for(int i=0 ; i<depth; i++)
{
pBuffer[i][0]=price;
price= (pBuffer[i] + pBuffer[i+1])/2.0;
summ+= price;
}

But then I realized that the part pbuffer[x][1] is using array from previous bar, and not the value pBuffer[i+1] from the current bars array. I tried to change pBuffer to dataserie but it was not able to read arrays from previous bars. If someone have some ideas about how to handle this kind of code, please let me know.


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Kalshi Sets $4.13B All-Time Weekly Record as Polymarket …
Prediction Markets & Event Contracts
Hormuz Normalization Collapses to 19.5% -- Iran Regime F …
Prediction Markets & Event Contracts
CME Group CEO Calls CFTC-Approved Crypto Perps Dangerous …
Traders Hideout
Post-Summit Market Verdict: ES -1%, NQ -1.5%, 10-Year Yi …
Traders Hideout
US Prop Firms Race Inside the CFTC Perimeter -- Tradeify …
Funded Trading Evaluation Firms
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
13 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #3 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,099 since Jun 2009
Thanks Given: 877
Thanks Received: 8,098



jjsshh View Post
Hi,
I have a hard time to convert ELA indicators that are using loops to NT. The problem is that NT cannot use arrays similar ways ELA language is able to do. Here is an example of what I am trying to convert to NT (for loop is the problem):

inputs:
depth = 10;

Array:
iprice = close;
pBuffer[30](0);
price = iprice;
summ=0;

for x=0 to depth-1
begin
pbuffer[x] = price;
price = (pbuffer[x] + pbuffer[x][1])/2.0;
summ+= price;
end;

I first came up with NT code like this:

for(int i=0 ; i<depth; i++)
{
pBuffer[i][0]=price;
price= (pBuffer[i] + pBuffer[i+1])/2.0;
summ+= price;
}

But then I realized that the part pbuffer[x][1] is using array from previous bar, and not the value pBuffer[i+1] from the current bars array. I tried to change pBuffer to dataserie but it was not able to read arrays from previous bars. If someone have some ideas about how to handle this kind of code, please let me know.

in ninja you don't have to declare arrays for O,H,L,C you just simply call it Close[0] = currentprice, Close[1] = previous price etc... make sure you don't call out of bound i.e. you have only 5 bars and try to call Close[5]


Reply With Quote
Thanked by:
  #4 (permalink)
jjsshh
Helsinki, Finland
 
Posts: 23 since Dec 2013
Thanks Given: 14
Thanks Received: 4

Thanks cory for your advice,

but I am not sure if that help in this case. If I understand the code correct the problem is that the array pBuffer is not storing Close but instead it is storing this: price = (pbuffer[x] + pbuffer[x][1])/2.0; I have read a more about this thing and it seems that it is impossible to call an array from previous bar.


Reply With Quote
  #5 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,099 since Jun 2009
Thanks Given: 877
Thanks Received: 8,098


jjsshh View Post
Thanks cory for your advice,

but I am not sure if that help in this case. If I understand the code correct the problem is that the array pBuffer is not storing Close but instead it is storing this: price = (pbuffer[x] + pbuffer[x][1])/2.0; I have read a more about this thing and it seems that it is impossible to call an array from previous bar.

you don't need array pBuffer, the O,H,L,C of prices are auto maintained by Ninja and ready for you to use.


Reply With Quote




Last Updated on July 21, 2015


© 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