Drawing arrows for an indicator in Prorealtime

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #251999 quote
    Ahimsa
    Participant
    New

    Hi everyone,

    It’s lovely to cyber meet you all. Please accept my apologies for the fact that no photo shot of me is showing yet. I have uploaded an image.

    I don’t know if anyone else is having the same problem as me, but I’m trying to write an indicator based on a strategy. Basically it will return arrows on the chart for buy and sell signals. The idea is that this indicator will then be connected to a Python bridge that links to IG’s API. This is the only way I can work with strategies in Prorealtime that reference x-volume candles instead of timebased ones. I’m using a 100 volume chart.

    The thing is, I can’t seem to get Prorealtime to draw any arrows on the chart. I’ve added the code for a simple test program I have tried. This is just to try and get Prorealtime to draw a green arrow when a bullish candle crosses the SMA 21. This program will run but no candles are drawn on the chart! Does anyone know why? Many thanks in advance.

    // Simple Test Program: Check if the last bullish candle crosses SMA 21

    // Define the period for the SMA
    SMA21 = Average (21)

    // Check if the last candle is bullish (close > open)
    isBullishCandle = close[1] > open[1]

    // Check if the last bullish candle crosses above the SMA 21
    crossAboveSMA21 = close[1] > SMA21[1] AND open[1] < SMA21[1] // Entry Condition: Bullish candle crossing SMA 21 entryCondition = isBullishCandle AND crossAboveSMA21 // Draw Green Up Arrow when the entry condition is met IF entryCondition THEN DRAWARROWUP(barindex[1], low[1] - 5) COLOURED(0, 255, 0, 255) // Green arrow up, fully opaque, placed 2 points below the low of the previous candle ENDIF // End of the indicator - Return to finish the code RETURN

    #252001 quote
    Ahimsa
    Participant
    New

    I’m sorry that the bottom bit of code has got compacted. I’ll make it easier to read.

    // Check if the last bullish candle crosses above the SMA 21
    crossAboveSMA21 = close[1] > SMA21[1] AND open[1] < SMA21[1]

    // Entry Condition: Bullish candle crossing SMA 21

    entryCondition = isBullishCandle AND crossAboveSMA21

    // Draw Green Up Arrow when the entry condition is met

    IF entryCondition THEN DRAWARROWUP(barindex[1], low[1] – 5) COLOURED(0, 255, 0, 255) // Green arrow up, fully opaque, placed 2 points below the low of the previous candle ENDIF

    // End of the indicator – Return to finish the code

    RETURN

    #252002 quote
    JC_Bywan
    Moderator
    Master

    Hi,

    I guess your indicator is in subwindow below the price window, rather than inside the price window itself? If that’s the case, then you need to take into account that only what’s asked to be drawn in the final return line is used to dimension that window, not the graphic objects from commands DRAWxx like arrows. So your arrows are probably drawn, but outisde the edges of the subwindow. You could do one of 2 things:

    Either you still wish a separate pane, so you need to add something to the return line (for example: return sma21) in order to give the window dimensions more likely to display the arrows

    Or  you could add to the price window your indicator with its empty return line unchanged, instead of below it.

    Iván González thanked this post
    #252004 quote
    Ahimsa
    Participant
    New

    Hi JC Bywan

    That was a very prompt response, thank you!

    No I’m adding my indicator to the price window where all my x-volume candles based on 100 volumes are being formed. I’m also tried adding the indicator to a time based price chart instead of an x-volume based one. The arrows are still not being drawn. I’m quite mystified.

    Thanks for trying to help though.

    Best wishes

    Ahimsa

    #252005 quote
    JC_Bywan
    Moderator
    Master

    Ok, instead of average(21), please use:

    SMA21 = Average[21](close)

    ( because although the (close) is not necessary, the [21] instead of (21) is the correct way to indicate 21 periods with the average keyword )

    Iván González thanked this post
    #252006 quote
    Ahimsa
    Participant
    New

    AWWWW WELL DONE! YOU’RE A STAR!!!!!

    Thank you so much! It’s working!

    Hip Hip Hurray!

    What you’ve done is priceless and I hope you have a really nice evening.

    Thanks again.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Drawing arrows for an indicator in Prorealtime


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Ahimsa @ahimsa Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by Ahimsa
5 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 09/29/2025
Status: Active
Attachments: No files
Logo Logo
Loading...