DAX 5 min Graph error?

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

    Hi

    I modified a code I found here on the forum so the code is not mine!

    I can’t start algao live.

    I receive an “graph” error message that cannot be used in automatic trading mode.

    Can anyone help me how I can get the code live 🙂

    DEFPARAM CumulateOrders = false
    DEFPARAM Preloadbars = 50000
    
    //TRADING TIME
    CtimeA = time >= 080000 and time <= 180000
    CtimeB = time >= 080000 and time <= 180000
    
    // Prevents the system from placing new orders on specified days of the week
    daysForbiddenEntry = OpenDayOfWeek = 3 OR OpenDayOfWeek = 4 OR OpenDayOfWeek = 0 OR OpenDayOfWeek = 0 OR OpenDayOfWeek = 0
    
    //POSITION SIZE
    PositionSize = 0.5
    
    HLS = 11 // Hour of Long Exit
    HSS = 11 // Hour of Short Exit
    
    //STRATEGY
    ONCE PeriodeA = 10
    ONCE nbChandelierA= 15
    ONCE PeriodeB = 20
    ONCE nbChandelierB= 35
    ONCE lag = 1.5
    
    MMA = Exponentialaverage[PeriodeA](close)
    ADJASUROPPO = (MMA-MMA[nbchandelierA]*pipsize) / nbChandelierA
    ANGLE = (ATAN(ADJASUROPPO))
    MMB = Exponentialaverage[PeriodeB](close)
    pente = (MMB-MMB[nbchandelierB]*pipsize) / nbchandelierB
    trigger = Exponentialaverage[PeriodeB+lag](pente)
    
    //BUY CONDITIONS
    CondBuy1 = ANGLE >= 35
    CondBuy2 = (pente > trigger) AND (pente < 0)
    CondBuy3 = average[100](close) > average[100](close)[1]
    CONDBUY = CondBuy1 and CondBuy2 and CondBuy3 and CTimeA
    
    //SHORT CONDITIONS
    CondSell1 = ANGLE <= - 40
    CondSell2 = (pente CROSSES UNDER trigger) AND (pente > -1)
    CondSell3 = average[20](close) < average[20](close)[1]
    CONDSELL = CondSell1 and CondSell2 and CondSell3 and CtimeB
    
    //POSITION LONGUE
    IF CONDBUY AND  not daysForbiddenEntry THEN
    buy PositionSize contract at market
    SET STOP %LOSS 2
    ENDIF
    
    //POSITION COURTE
    IF CONDSELL AND  not daysForbiddenEntry THEN
    Sellshort PositionSize contract at market
    SET STOP %LOSS 2
    ENDIF
    
    // trailing stop atr [adjusted reset]
    once enablets=1
    once displayts=1
     
    if enablets then
    //
    once steps=0.05
    once minatrdist=3
     
    once atrtrailingperiod    = 14   // atr parameter value
    once minstop              = 10   // minimum trailing stop distance
     
    if barindex=tradeindex then
    trailingstoplong     = 5   // trailing stop atr relative distance
    trailingstopshort    = 5   // trailing stop atr relative distance
    elsif prezzouscita>0 then
    if longonmarket then
    if trailingstoplong>minatrdist then
    if prezzouscita>prezzouscita[1] then
    trailingstoplong=trailingstoplong
    else
    trailingstoplong=trailingstoplong-steps
    endif
    else
    trailingstoplong=minatrdist
    endif
    endif
     
    if shortonmarket then
    if trailingstopshort>minatrdist then
    if prezzouscita<prezzouscita[1] then
    trailingstopshort=trailingstopshort
    else
    trailingstopshort=trailingstopshort-steps
    endif
    else
    trailingstopshort=minatrdist
    endif
    endif
    endif
    //
    atrtrail=averagetruerange[atrtrailingperiod]((close/10)*pipsize)/1000
    trailingstartl=round(atrtrail*trailingstoplong)
    trailingstarts=round(atrtrail*trailingstopshort)
    tgl=trailingstartl
    tgs=trailingstarts
    //
    if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) then//or (longonmarket and condsell) or (shortonmarket and condbuy) then
    maxprice=0
    minprice=close
    prezzouscita=0
    endif
    //
    if longonmarket then//and not condsell then
    maxprice=max(maxprice,close)
    if maxprice-tradeprice(1)>=tgl*pointsize then
    if maxprice-tradeprice(1)>=minstop then
    prezzouscita=maxprice-tgl*pointsize
    else
    prezzouscita=maxprice-minstop*pointsize
    endif
    endif
    endif
    //
    If LongOnMarket AND Hour=HLS THEN//
    SELL AT MARKET
    ENDIF
    
    if shortonmarket then//and not condbuy then
    minprice=min(minprice,close)
    if tradeprice(1)-minprice>=tgs*pointsize then
    if tradeprice(1)-minprice>=minstop then
    prezzouscita=minprice+tgs*pointsize
    else
    prezzouscita=minprice+minstop*pointsize
    endif
    endif
    endif
    //
    if onmarket and prezzouscita>0 then
    exitshort at prezzouscita stop
    sell at prezzouscita stop
    endif
    if displayts then
    graphonprice prezzouscita coloured(0,0,255,255) as "trailingstop atr"
    endif
    endif
    IF ShortOnMarket AND Hour=HSS THEN
    EXITSHORT AT MARKET
    ENDIF
    
    graf.jpg graf.jpg
    #115358 quote
    StefanbStefanb
    Participant
    Senior

    Error message

    error.jpg error.jpg
    #115361 quote
    turameturame
    Participant
    Master

    Hi,

    You have juste to delete the following lines :

    -> 57

    -> From 138 to 140

    Have a nice day

    #115362 quote
    StefanbStefanb
    Participant
    Senior

    Thanks turame 🙂

Viewing 4 posts - 1 through 4 (of 4 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

DAX 5 min Graph error?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Stefanb @stefanb Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by StefanbStefanb
6 years, 9 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/22/2019
Status: Active
Attachments: 2 files
ProRealCode ProRealCode
Loading...