NexusFi: Find Your Edge


Home Menu

 





What does VarName.Set(1, VarName[1]) do?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one jvbehar with 4 posts (0 thanks)
    2. looks_two Xeno with 1 posts (0 thanks)
    3. looks_3 eDanny with 1 posts (0 thanks)
    4. looks_4 Big Mike with 1 posts (0 thanks)
    1. trending_up 1,710 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 7 posts
    2. attach_file 2 attachments




 
Search this Thread

What does VarName.Set(1, VarName[1]) do?

  #1 (permalink)
jvbehar
Miami, Florida USA
 
Posts: 5 since Dec 2010
Thanks Given: 0
Thanks Received: 0

Hello All: What does this statement do?

VarName.Set(1, VarName[1])

Is the "1" an initialization value of some sort?

Thank you for any guidance you can provide.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
Cheap historycal L1 data for stocks
Stocks and ETFs
Quant vue
Trading Reviews and Vendors
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
What broker to use for trading palladium futures
Commodities
 
  #3 (permalink)
 Xeno 
UK
 
Experience: Intermediate
Platform: Ninja
Broker: Mirus/Zen
Trading: Futures - bonds, currencies, index
Posts: 288 since Oct 2010
Thanks Given: 70
Thanks Received: 274


The "1" is an index into an array called VarName.

VarName[1] means the element in the array which has index 1.

Reply With Quote
  #4 (permalink)
jvbehar
Miami, Florida USA
 
Posts: 5 since Dec 2010
Thanks Given: 0
Thanks Received: 0

Xeno, thank you for your reply. This is from the attached Ninja script for the SuperTrend Indicator. I was refering to the first "1", in the line

VarName.Set(1, VarName[1]) (the [1] reference here is to "the value at prior bar")

There are no arrays defined as far as I can see. There are references of similar structure with a single dimension such as

VarName.Set(VarName[1]);

so to see the two arguments is throwing me off.

I am experienced in EL and am trying to convert from the NT script.

Thank you for again for your attention.

Attached Files
Elite Membership required to download: Supertrend Code.txt
Reply With Quote
  #5 (permalink)
 
eDanny's Avatar
 eDanny 
East Rochester, NY
 
Experience: Intermediate
Platform: NT
Posts: 329 since Jul 2009
Thanks Given: 18
Thanks Received: 425

This is referencing a plot. The first 1 means plot one bar back and the [1] means use the value from one bar back in that plot. This is usually used to join two different line plots together when the color changes else you might get a one bar blank spot.

Dan

Reply With Quote
  #6 (permalink)
jvbehar
Miami, Florida USA
 
Posts: 5 since Dec 2010
Thanks Given: 0
Thanks Received: 0

Danny, got it, thank you very much!

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,463 since Jun 2009
Thanks Given: 33,239
Thanks Received: 101,661


jvbehar View Post
Xeno, thank you for your reply. This is from the attached Ninja script for the SuperTrend Indicator.

If your intention is to convert SuperTrend to EL, check here:


Mike

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)
jvbehar
Miami, Florida USA
 
Posts: 5 since Dec 2010
Thanks Given: 0
Thanks Received: 0

Mike, thanks for tip. That is actually where I started. I ran your code but the display was nothing like the NT indicator that supposedly does the same thing. I could not really tell why, hence I needed to convert line-by-line directly from the NT script to see where the discrepancy was. I believe the code difference is minor but the resulting display differences are not.

If you are familiar with Ninja script I would appreciate if you take a quick look at the attached, maybe something will jump out at you.

Thank you in advance.

JBehar

Attached Files
Elite Membership required to download: Supertrend Code.txt
Reply With Quote




Last Updated on December 5, 2010


© 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