ma 50 distance

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #218737 quote
    kvacksa87
    Participant
    New

    Hello i want help with automatic trade

    distance to ma50 in 3 minute graph. buy when price is 50 pips from ma50 and sell when it touches ma50 both long and short

    #218800 quote
    robertogozzi
    Moderator
    Master

    There you go:

    ma50 = average[50,0](close)
    IF Not OnMarket THEN
       IF close <= (ma50 - 50*PipSize) THEN
          BUY 1 Contract at Market
       ELSIF close >= (ma50 + 50*PipSize) THEN
          SELLSHORT 1 Contract at Market
       ENDIF
    ENDIF
    IF LongOnMarket THEN
       IF high >= ma50 THEN
          SELL at Market
       ENDIF
    ELSIF ShortOnMarket THEN
       IF low <= ma50 THEN
          EXITSHORT at Market
       ENDIF
    ENDIF
    graphonprice ma50 - 50*PipSize AS "Long trigger"  coloured("Green")
    graphonprice ma50 + 50*PipSize AS "Short trigger" coloured("Red")

    you may either comment out or remove the last two lines if you don’t need them.

    kvacksa87 thanked this post
    #219003 quote
    kvacksa87
    Participant
    New

    Thank you so mutch. I thought the last 2 lines were very good and useful. so I have a question for you if you can code so I take inputs on them instead? buy when the lowest price of the bar crosses below the green line and short when it crosses up the red

    #219343 quote
    robertogozzi
    Moderator
    Master

    What is the green line, how is it formed?

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

ma 50 distance


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
kvacksa87 @kvacksa87 Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 08/08/2023
Status: Active
Attachments: 1 files
Logo Logo
Loading...