2 SupeTrend + Media Mobile DAX 5 minuti

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #96124 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Ho trovato in giro questa strategia e la posto per chi volesse usarla, modificarla, magari migliorarla se possibile:

    //-------------------------------------------------------------------------
    // Definizione dei parametri del codice
    DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate
    
    // Condizioni per entrare su posizioni long
    indicator1 = SuperTrend[2.7,27]
    indicator2 = SuperTrend[1.5,10]
    c1 = (indicator1 CROSSES OVER indicator2)
    indicator3 = Average[100](close)
    c2 = (indicator3 CROSSES OVER close)
    
    IF c1 AND c2 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    // Condizioni per entrare su posizioni short
    indicator4 = SuperTrend[2.7,27]
    indicator5 = SuperTrend[1.5,10]
    c3 = (indicator4 CROSSES UNDER indicator5)
    indicator6 = Average[100](close)
    c4 = (indicator6 CROSSES UNDER close)
    
    IF c3 AND c4 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    // Stop e target
    SET STOP   %LOSS   1       //1
    SET TARGET %PROFIT 3.5     //3.5
    /////////////////////////////////////////////////////////
    //trailing stop
    trailingstop = 40          //40
    //resetting variables when no trades are on market
    if not onmarket then
    MAXPRICE = 0
    MINPRICE = close
    priceexit = 0
    endif
    //case SHORT order
    if shortonmarket then
    MINPRICE = MIN(MINPRICE,close) //saving the MFE of the current trade
    if tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
    priceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price level
    endif
    endif
    //case LONG order
    if longonmarket then
    MAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current trade
    if MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
    priceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price level
    endif
    endif
    //exit on trailing stop price levels
    if onmarket and priceexit>0 then
    EXITSHORT AT priceexit STOP
    SELL AT priceexit STOP
    endif
    x-11.jpg x-11.jpg 2STrMM-Dax-5min.itf
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

2 SupeTrend + Media Mobile DAX 5 minuti


ProOrder: Trading Automatico & Backtesting

New Reply
Author
Summary

This topic contains 1 voice and has 0 replies.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 04/11/2019
Status: Active
Attachments: 2 files
ProRealCode ProRealCode
Loading...