NexusFi: Find Your Edge


Home Menu

 





Converting Multicharts variables to NinjaTrader


Discussion in NinjaTrader

Updated
    1. trending_up 2,017 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?
NYSE Owner ICE Invests in Crypto Exchange OKX at $25 Bil …
Cryptocurrency
Orban at 29pct as Hungary Votes Tomorrow -- McIlroy Surg …
Prediction Markets & Event Contracts
April 2026 Jobs Report: +115k vs +65k Expected
Traders Hideout
Saylors 41-Month HODL Breaks: Strategy Sells 32 BTC as $ …
Prediction Markets & Event Contracts
Iran Peace Expired NO: Ceasefire on Life Support, OPEC a …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 
cory's Avatar
 cory 
virginia
the coin hunter
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,093



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
the coin hunter
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,093


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