Supertrend Grün im Code

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #211998 quote
    axmichi
    Participant
    Senior

    Hallo Ich habe eine Frage-

     

    Ich möchte in den Trade einsteigen (kaufen) wenn die Farbe vom Supertrend Grün ist.

     

    Wie muss man das im Code schreiben??

     

    Danke

    #212007 quote
    robertogozzi
    Moderator
    Master

    Da ist er:

    myST  = Supertrend[3,10]
    Green = close > myST
    IF Green AND Not OnMarket THEN
       BUY 1 Contract at Market
    ENDIF
    SET STOP   pLOSS   100
    SET TARGET pPROFIT 300
    #212033 quote
    axmichi
    Participant
    Senior

    Hallo Danke,

     

    könnte Sie den SL ändern bitte.

    Ich möchte einen Trailing Stop einfügen der mit ATR * 3 mit geht?

     

    Vielen Dank!!

    #212074 quote
    robertogozzi
    Moderator
    Master

    Sie können Stop Loss, Take Profit und Trailing Start nach Belieben ändern.

    myST  = Supertrend[3,10]
    Green = close > myST
    IF Green AND Not OnMarket THEN
       BUY 1 Contract at Market
       SET STOP   pLOSS   400
       SET TARGET pPROFIT 800
    ENDIF
    // ATR Trailing Stop
    //
    TrailStart = 30
    IF Not OnMarket THEN
       Atr = averagetruerange[14](close) * 2
       StopLossL = close + Atr
       StopLossS = close - Atr
       ExitPrice = 0
    ENDIF
    myProfit   = PositionPrice * PositionPerf / PipSize
    IF myProfit >= TrailStart * PipSize THEN
       IF ExitPrice = 0 THEN
          IF LongOnMarket THEN
             ExitPrice = StopLossL
          ELSIF ShortOnMarket THEN
             ExitPrice = StopLossS
          ENDIF
       ENDIF
       IF LongOnMarket AND close > (ExitPrice + Atr + (TrailStart * PipSize)) THEN
          ExitPrice = ExitPrice + Atr
       ELSIF ShortOnMarket AND close < (ExitPrice - Atr - (TrailStart * PipSize)) THEN
          ExitPrice = ExitPrice - Atr
       ENDIF
    ENDIF
    IF LongOnMarket AND (ExitPrice > 0) THEN
       SELL      AT ExitPrice STOP
    ELSIF ShortOnMarket AND (ExitPrice > 0) THEN
       EXITSHORT AT ExitPrice STOP
    ENDIF
    //graphonprice StopLossL coloured("Green",255)
    //graphonprice StopLossS coloured("Blue",255)
    //graph        myProfit
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Supertrend Grün im Code


ProOrder: Automatischer Handel & Backtesting

New Reply
Author
author-avatar
axmichi @axmichi Participant
Summary

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

Topic Details
Forum: ProOrder: Automatischer Handel & Backtesting
Language: German
Started: 03/23/2023
Status: Active
Attachments: No files
Logo Logo
Loading...