convert pine-script strategy into indicator alert

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #182337 quote
    bragsens
    Participant
    New

    // please help me with this strategy into alert indicator!!
    //@version=5
    strategy(title=’trail_points’, overlay=true, initial_capital=5000, default_qty_value=50)

    rib_grp = ‘Moving Average Settings’
    ma(source, length, type) => type == “SMA” ? ta.sma(source, length) : type == “EMA” ? ta.ema(source, length) : type == “SMMA (RMA)” ? ta.rma(source, length) : type == “WMA” ? ta.wma(source, length) : type == “VWMA” ? ta.vwma(source, length) : na

    show_ma1 = input(true , “MA №0″, inline=”MA #0”, group=rib_grp)
    ma1_type = input.string(“SMA” , “” , inline=”MA #0″, options=[“SMA”, “EMA”, “SMMA (RMA)”, “WMA”, “VWMA”], group=rib_grp)
    ma1_source = input(low , “” , inline=”MA #0″, group=rib_grp)
    ma1_length = input.int(34 , “” , inline=”MA #0″, minval=1, group=rib_grp)
    ma1_color = input(#000000, “” , inline=”MA #0″, group=rib_grp)
    ma1 = ma(ma1_source, ma1_length, ma1_type)
    plot(show_ma1 ? ma1 : na, color = ma1_color, title=”MA №0″)

    // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ //
    long_entry = ma1<close
    long_exit = ta.crossover(ma1, close)

    // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ //

    trail_p = input.int(defval=460, step=10)
    trail_o = input.int(defval=0, step=10)

    strategy.entry(‘long’, strategy.long, when=long_entry) //true
    strategy.exit(‘TP’, ‘long’, trail_points=trail_p, trail_offset=trail_o)
    strategy.close(‘long’, when=long_exit, comment=’close’)

    #182464 quote
    Nicolas
    Keymaster
    Master

    Alert on what conditions please?

    If it is about the “long entry”, the condition is simple: the moving average of X type (SMA by default) applied on price Low and period of 34 is under the Close. You can create it by using the embedded Alert tool of the platform. It’s easy:

    https://www.prorealtime.com/en/help-manual/create-market-alerts

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

convert pine-script strategy into indicator alert


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
bragsens @bragsens Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
4 years, 2 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 11/26/2021
Status: Active
Attachments: No files
Logo Logo
Loading...