Unable to use DPO in strategy.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #127553 quote
    rama
    Participant
    Senior
    //############################
    //Dumb fellow Indicator
    //#############################################################
    
    c1=MACD[12,26,9](close)
    once rr=1
    
    mb=average[20](typicalprice)
    k=48
    n=(k*2)-4
    p=(n/2)-1
    
    h1=DPO[n](high)
    
    moyh=high-h1
    hi=(moyh-moyh[1]+(high[p])/n)*n
    hi=(round(hi*100))/100
    l1=dpo[n](low)
    
    moyl=low-l1
    lo=(moyl-moyl[1]+(low[p])/n)*n
    lo=(round(lo*100))/100
    clo1=dpo[n](close)
    
    moyc=close-clo1
    clot=(moyc-moyc[1]+(close[p])/n)*n
    clot=(round(clot*100))/100
    cond1=(high>high[1] and high>high[2])
    cond2=(cond1 and high>hi[46]) and (barindex>bari or rr=-1)
    if cond1 and cond2 then
    flagg=1
    targeth=high
    targetl=lo[46]
    else
    flagg=0
    signa=mb
    endif
    for zz=0 to 45
    if clot[45-zz]<targetl and hi[45-zz]<=targeth and flagg=1  then
    signa=high+(averagetruerange[20](close))*.5
    rr=1
    bari=barindex+zz+2
    break
    elsif     hi[45-zz]>targeth then
    signa=mb
    break
    endif
    next
    condi=(low<low[1] and low<low[2]) and low<lo[46] and (barindex>bar or rr=1)
    if condi then
    fflag=1
    target1=low
    target2=hi[46]
    else
    fflag=0
    siigna=mb
    endif
    for kk=0 to 45
    if clot[45-kk]>target2 and lo[45-kk]>=target1 and fflag=1 then
    siigna=low-(averagetruerange[20](close))*.5
    rr=-1
    bar=barindex+kk+2
    break
    elsif lo[45-kk]<target1 then
    siigna=mb
    break
    endif
    next
    if barindex < 100 then
    signa=undefined
    siigna=undefined
    endif
    golong = (siigna < mb) and c1>=-5 and rsi[2]<=32
    
    goshort = (signa > mb)*-1 and c1<=5 and rsi[2]>=68
    return golong as  "LONG",goshort as "SHORT",0
    

    I am trying to to use the above indicator in program which does not allow to place orders. where as i can trigger an order through alert . Is there any way to replace the word “DPO” with equivalent code?

    #127554 quote
    Vonasi
    Moderator
    Master

    The DPO indicator repaints itself which is why it always looks so impressive – much like the Zig Zag indicator always looks impressive. Because the returned value is able to change is the reason why it is not possible to use them in auto strategies. Adding code to recreate the DPO will not fix this.

    Please try to use more descriptive topic titles rather than just ‘DPO’. I have edited your title to something more meaningful.

    #127557 quote
    Nicolas
    Keymaster
    Master

    You can still use the DPO of past values, which is indeed not as accurate of the one that use future data!!

    // **** DPO of past moving average and not future ones :
    
    p = 14
    
    avg = average[p](customclose)
    r = round(p/2) +1
    b = customclose - avg[r]
    myDPO = b
    
    RETURN myDPO as "Detrented Price Oscillator of past datas", 0 coloured(10,10,255) as "0"
    #127593 quote
    rama
    Participant
    Senior

    This code is giving less accurate results

    however I can use my own code through alert. However there is limitation in setting up alter it has to be set up every order and gets disable.

     

    if I want to set up all 20 orders though alert with a interval of 30

    say alert triggers with condition1 and condition 2

    condition is time>=120000 and time<=1230000

    what will be indicator for this

    c1= time

    return c1 ?

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

Unable to use DPO in strategy.


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
rama @rama Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/23/2020
Status: Active
Attachments: No files
Logo Logo
Loading...