Plot indicator on the Chart
Forums › ProRealTime English forum › ProBuilder support › Plot indicator on the Chart
- This topic has 5 replies, 2 voices, and was last updated 3 hours ago by JC_Bywan.
-
-
04/18/2020 at 12:25 PM #12672504/18/2020 at 12:39 PM #12672804/18/2020 at 3:25 PM #12674701/10/2025 at 12:34 PM #242381
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”01/10/2025 at 12:35 PM #242383defparam 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”
Help me fix this error
01/10/2025 at 2:27 PM #242394Hi,
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
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on