Sydney NSW Australia
Experience: Intermediate
Platform: TradeStation, Oanda
Trading: Forex, index futures
Frequency: Daily
Duration: Days
Posts: 177 since Jun 2020
Thanks Given: 18
Thanks Received: 166
|
In case it could be of interest to anyone, I wrote a short code for the indicator that counts the number of up closes in the defined period and expresses them as a ratio. So If the price closed up 6 times out of 10 it will be expressed as 0.6. On top of that the indicator plots the average of this value of the same length. The code is bare, so no colors or styles pre-defined.
{Counts the number of bars within the specified length where close > open}
Inputs: Length(9);
Vars: UpBars(0),
Count (0),
UpBarCount(0),
CCBars(0),
CCCount(0);
UpBars = 0;
CCBars = 0;
For count = 0 to Length-1 begin
If close[count] > open[count] then UpBars = UpBars + 1;
End;
UpBarCount = UpBars/Length;
CCCount = CCBars/Length;
Plot1 (UpBarCount, "BarCount" );
Plot2 (0.5, "Breakeven");
Plot3 (Average(UpBarCount, Length), "Avg");
|