SUPERTREND AUTAMATIQUE

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #3346 quote
    groen200
    Participant
    Veteran

    hi
    congratulations with this site.
    i trade now automatic, crosssing the supertrend.
    time frame 5 min
    dax 30 mini
    8.00 tot 12.00
    if it possible , go in trade directly 8.00 before the first signal crossing supertrend.
    with condition, for long: price > supertrend
    for short; price < supertrend
    thank you
    luc

    #3347 quote
    groen200
    Participant
    Veteran
    // Definitie van code parameters
    DEFPARAM CumulateOrders = False // Opstapelen posities gedeactiveerd
    DEFPARAM FLATBEFORE=080000
    DEFPARAM FLATAFTER=120000
    // Condities om long posities te openen
    indicator1 = close
    indicator2 = SuperTrend[2.8,3]
    c1 = (indicator1 CROSSES OVER indicator2)
    
    IF c1 THEN
    BUY 1 LOT AT MARKET nextbaropen
    ENDIF
    
    // Condities om long posities te sluiten
    indicator3 = close
    indicator4 = SuperTrend[2.8,3]
    c2 = (indicator3 CROSSES UNDER indicator4)
    
    IF c2 THEN
    SELL  AT MARKET
    ENDIF
    
    // Condities om short posities te openen
    indicator5 = close
    indicator6 = SuperTrend[2.8,3]
    c3 = (indicator5 CROSSES UNDER indicator6)
    
    IF c3 THEN
    SELLSHORT 1 lot at market nextbaropen
    ENDIF
    
    // Condities om short posities te sluiten
    indicator7 = close
    indicator8 = SuperTrend[2.8,3]
    c4 = (indicator7 CROSSES OVER indicator8)
    
    IF c4 THEN
    EXITSHORT  AT MARKET
    ENDIF
    
    // Stops en targets
    SET STOP $LOSS 150
    SET TARGET $PROFIT 700
    #3349 quote
    Nicolas
    Keymaster
    Master

    Hello groen200,

    We already talked on Skype, let me look at your code.

    What you want is just to open a new long position if the price is above the Supertrend and sell it if the price is below it? right?

    Do you want also to have multiple orders in the same day or just only one?

    #3350 quote
    groen200
    Participant
    Veteran

    OK for to open a new long position if the price is above the supertrend and sell it if the price is below it

    and then start my code crossing the supertrend, when we have (like to day) no crossing before 12.00 = no trade more

    #3358 quote
    Nicolas
    Keymaster
    Master

    Here is the modified code groen200, hope it will be in accordance with your strategy as far as i understand it! 🙂 Supertrend groen200

    // Definitie van code parameters
    DEFPARAM CumulateOrders = False // Opstapelen posities gedeactiveerd
    
    DEFPARAM FLATBEFORE=080000
    DEFPARAM FLATAFTER=120000
    
    //indi
    st = SuperTrend[2.8,3]
    
    //resetting variable
    once lasttrade = 0
    
    IF LONGONMARKET then 
      lasttrade = 1
    elsif SHORTONMARKET then
      lasttrade = -1
    elsif hour<8 OR hour>12 then
      lasttrade = 0
    endif
    
    // Condities om long posities te openen
    IF close>st AND lasttrade<>1 THEN
      EXITSHORT  AT MARKET
      BUY 1 LOT AT MARKET nextbaropen
    
    ENDIF
    
    // Condities om long posities te sluiten
    IF close<st AND lasttrade<>-1 THEN
      SELL  AT MARKET
      SELLSHORT 1 lot at market nextbaropen
    
    ENDIF
    
    // Stops en targets
    SET STOP $LOSS 150
    SET TARGET $PROFIT 700
    
    GRAPH lasttrade AS "lasttrade"
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

SUPERTREND AUTAMATIQUE


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
groen200 @groen200 Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by Nicolas
9 years, 11 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/01/2016
Status: Active
Attachments: No files
Logo Logo
Loading...