This may be my lack of knowledge showing but I don't even know how to frame such a question to google or even ask in a "C" language forum elsewhere. I am trying to record basic OHLC info during every single retracement, only to capture the last high or low prior to a change in an basic indicator. However, I don't think I am passing the correct information or the correct information in the correct way. Please advise.
//Condition 1
if (BarsInProgress != 0)
RTHID = +1;
RTHHID = +1;
// Set 1
if (((Close[1] > Open[1]) // If bar 1 is an up bar and bar 0 is a down bar
&& (Close[0] < Open[0]) // and close of bar 1 is higher than the variable which recorded the last close...
&& RTHC < Close[1]))
{
RTHC = Close[1]; // Record new higher close
RTHH = High[HighestBar(High, 2)]; // Record highest high out of bar 1 and bar 2
RTHID = 1; // Set index of up bar
RTHHID = HighestBar(High, 2); // Set index of which bar had the highest high
If I add this to see what the script is doing:
Draw.ArrowDown(this, "S" + CurrentBar, true, RTHHID, RTHH + (4 * TickSize), Brushes.Yellow); // Then draw an arrow down 4 ticks above the high of the highest bar
For instance, if I add:
if ((Slope(SMA1, 2, 1) > 0) // If Slope changes from up to down
&& (Slope(SMA1, 1, 0) < 0))
{
//
SHH1 = RTHH; // Pass the previous Rtracement Highest to the new variable
SHBarID1 = RTHHID; // Pass index value of RTHHID into the new variable;
}
Draw.ArrowDown(this, "S" + CurrentBar, true, SHBarID1, SHH1+ (4 * TickSize), Brushes.Yellow); // Then draw an arrow down 4 ticks above the high of the highest bar
Is there a way that RTHHID can be set to record the index of "HighestBar(High, 2)" that it can be passed to another variable later as the int index value of "HighestBar(High, 2)" from a previous condition that will not just be the script "HighestBar(High, 2)" being passed into the new variable.?
Thank you,
Sam

Comment