Specification
you just have to change the way of working in tick of the old version indicator in price movement
int start()
{
double currentPrice = SymbolInfoDouble(_Symbol, SYMBOL_BID);
static double prevPrice = 0;
static int upCount = 0;
static int downCount = 0;
static datetime lastUpdate = 0;
static bool isFirstBar = true;
// Initialize on first bar
if (isFirstBar)
{
prevPrice = currentPrice;
isFirstBar = false;
lastUpdate = Time[0];
}
// Calculate price movements
if (Time[0] != lastUpdate)
{
double priceChange = currentPrice - prevPrice;
// Update movement counters
if (priceChange > 0)
upCount++;
else if (priceChange < 0)
downCount++;
// Calculate movement speeds
double upSpeed = (double)upCount / Period;
double downSpeed = (double)downCount / Period;
// Update buffers
FastBuffer[0] = upSpeed;
SlowBuffer[0] = downSpeed;
// Reset for new period
upCount = 0;
downCount = 0;
prevPrice = currentPrice;
lastUpdate = Time[0];
}
return(0);
}
// Replace tick-based parameters with price movement parameters
extern string Block1="--- Price Movement Parameters ---";
extern double PriceThreshold = 0.1; // Minimum price change to count as movement
extern int FastPeriod = 10; // Number of bars for fast calculation
extern int SlowPeriod = 40; // Number of bars for slow calculation
int init()
{
int i=0;
SetIndexBuffer(i++, FastBuffer); // Upward movement speed
SetIndexBuffer(i++, SlowBuffer); // Downward movement speed
SetIndexEmptyValue(i, EMPTY_VALUE);
// Set appropriate scale for price movements
IndicatorSetDouble(INDICATOR_MINIMUM, 0);
IndicatorSetDouble(INDICATOR_MAXIMUM, 100);
return(INIT_SUCCEEDED);
}
if you think you can copy paste the new code,, write to me
Thanks!!