|
Shenandoah Valley, VA
Experience: Advanced
Platform: NT8
Broker: NinjaTrader introduced to Dorman
Trading: ES, CL, 6E, ZN
Posts: 14 since Jan 2011
Thanks Given: 5
Thanks Received: 3
|
Thanks for taking a stab at it Sunpost... who wrote..
int InstPeriod = 0;
int Value4 = 0;
for (int count = 0; count <= 50; count++)
{
Value4 =+ DeltaPhase[count];
if (Value4 > 360 && InstPeriod == 0)
{
InstPeriod = count;
}
}
DeltaPhase is just a double, so I dropped the [count] from DeltaPhase[count] in your answeras that would not compile... looks like the compiler was thinking the [count] was addressing an array... so I have this now...
//Sum DeltaPhases to reach 360 degrees. The sum is the instantaneous period.
InstPeriod = 0;
Value4 = 0;
for (int count = 0; count < 50; count++)
{
Value4 =+ DeltaPhase;
DrawTextFixed("Tag1",Value4.ToString(),TextPosition.BottomRight); //for debugging
if (Value4 >360 && InstPeriod == 0)
{
InstPeriod = count;
DsInstPeriod[0] = InstPeriod;
//DrawTextFixed("Tag1",InstPeriod.ToString(),TextPosition.BottomRight);
}
}
The DrawTexts I'm using for debugging... What's happening is that DeltaPhase gets added to Value4 once, and gets drawn, but then the if statement never executes... I believe because the loop doesn't run, doesn't keep adding DeltaPhase to Value4, so Value 4 never gets greater than 360 for the if statement to evaluate to true.
Any help much appreciated.
|