Dear friends,
I having problem with plotting indicator (itf. file) on the chart , it was plotted below from the chart.
How do set this indicator on the chart.
Add it on the price, by clicking on “price” then “add indicator”.
Dear Nicolas,
Thanks for your prompt response.
defparam drawonlastbaronly = true
// Parameters for Moving Averages, Bollinger Bands, and Volume Threshold
emaShortPeriod = 9
emaLongPeriod = 21
bollingerPeriod = 20
bollingerDeviation = 2
volumeMultiplier = 1.5
arrowLength = 10 // Length of the arrow in price units
// Calculate EMAs, Bollinger Bands, and Volume
emaShort = exponentialaverage[emaShortPeriod]
emaLong = exponentialaverage[emaLongPeriod]
bollingerMiddle = average[bollingerPeriod]
bollingerUpper = bollingerMiddle + std[bollingerPeriod] * bollingerDeviation
bollingerLower = bollingerMiddle – std[bollingerPeriod] * bollingerDeviation
averageVolume = average[50](volume)
// Signal Conditions
isBuySignal = emaShort > emaLong and close < bollingerLower and volume > averageVolume * volumeMultiplier
isSellSignal = emaShort < emaLong and close > bollingerUpper and volume > averageVolume * volumeMultiplier
// Draw Segments for Buy Signals
if isBuySignal then
DRAWSEGMENT(barindex, low – arrowLength, barindex, low, rgb(0,255,0)) // Green upward segment for Buy
endif
// Draw Segments for Sell Signals
if isSellSignal then
DRAWSEGMENT(barindex, high + arrowLength, barindex, high, rgb(255,0,0)) // Red downward segment for Sell
endif
// Display EMA lines for trend identification
return emaShort as “EMA Short”, emaLong as “EMA Long”
Hi,
DRAWSEGMENT(barindex, low – arrowLength, barindex, low, rgb(0,255,0)) // Green upward segment for Buy
… is not the correct syntax to assign a color to your segment, instead it should be written as follows:
DRAWSEGMENT(barindex, low – arrowLength, barindex, low) coloured(0,255,0) // Green upward segment for Buy
Same thing for the red one and its incorrect rgb(255,0,0), full line to be replaced with:
DRAWSEGMENT(barindex, high + arrowLength, barindex, high) coloured(255,0,0) // Red downward segment for Sell