NexusFi: Find Your Edge


Home Menu

 





Having some issues with this code. Please help.


Discussion in NinjaTrader

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




 
Search this Thread

Having some issues with this code. Please help.

  #1 (permalink)
kaywai
singapore
 
Posts: 131 since Nov 2009
Thanks Given: 11
Thanks Received: 7

 
Code
if (Close[0]<=Low[2])
{
if (BuySeqCount < 12)
{
BuySeqCount++;
DrawText("BuySeq"+CurrentBar, BuySeqCount.ToString(), 0, (Low[0]-(2*TickSize)), Color.Red);
if (BuySeqCount == 5)
{
buycountdown5 = Close[0];
Print("buycountdown5 is" + Close[0]);
}
if (BuySeqCount == 8)
{
buycountdown8 = Close[0];
Print("buycountdown8 is" + Close[0].ToString());
}
}
elseif (BuySeqCount == 12)
{
if ((Low[0] <= buycountdown8))
{
Print("Low[0] is" + Low[0]);
Print("buycountdown8 is" + Close[0]);
BuySeqCount++;
DrawText("BuySeq"+CurrentBar, BuySeqCount.ToString(), 0, (Low[0]-(2*TickSize)), Color.Red);
flagBS9 = false;
SequentialCountdownInProgress = false;
BuySeqCount = 0;
}
else
{
DrawText("BuySeq"+CurrentBar, "+", 0, (Low[0]-(2*TickSize)), Color.Red);
}
}
I want to compare the 8th count vs the 5th count and the 13th count vs the 8th count.
Problem No.1: My private double values changes.
Problem No.2: Not sure how to code the 8th vs 5th

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Deepmoney LLM
Elite Quantitative GenAI/LLM
Build trailing stop for micro index(s)
Psychology and Money Management
Exit Strategy
NinjaTrader
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
 
  #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



Quoting 
I want to compare the 8th count vs the 5th count and the 13th count vs the 8th count.
Problem No.1: My private double values changes.
Problem No.2: Not sure how to code the 8th vs 5th

your codes will get more complicate as you compare more and more variables
the best practice is to save those values into an array, due to Ninja programming (think of it a perm loop for each new bar added it will start back from bar #1 again) the values stored in the array will be shifted but they are in there you just have to know which is which.

// declare an array in #region Variables

private double[] arrayGap = new double[13000];
....
// example to store value into an array
// do gap storing into an array
 
Code
arrayGap[Cnt] = Instrument.MasterInstrument.Round2TickSize(Open[0] - Close[0]);
// use print to debug
// Print(" current open "+Open[0]+ " prior close " + gapLast);

good luck.

Reply With Quote
Thanked by:
  #4 (permalink)
kaywai
singapore
 
Posts: 131 since Nov 2009
Thanks Given: 11
Thanks Received: 7

Thanks Cory! Feels like it's back to the drawing board for now!

Reply With Quote




Last Updated on March 4, 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