Doji strategy Test

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #236642 quote
    Aragorna
    Participant
    Junior
    DEFPARAM CumulateOrders = false
    Timeframe(Daily,UpdateOnClose)
    Positionsize=1
    //C3=TIME=<220000
    
    DojiSize = K4 //0.15
    Doji=(abs(Dopen(1) - Dclose(1)) <= (DHigh(1) - Dlow(1)) * DojiSize)
    DojiPositionHigh= (Dclose(1)and Dopen(1))>=Dlow(1)+0.666*(DHigh(1) - Dlow(1))
    DojiPositionLow= (Dclose(1)and Dopen(1))<=Dlow(1)+0.333*(DHigh(1) - Dlow(1))
    
    if doji and DojiPositionHigh then
    Flag=1
    else
    flag=0
    endif
    if doji and DojiPositionLow then
    Flag=2
    else
    flag=0
    endif
    //DojiPositionMiddle
    if doji and not DojiPositionHigh and not DojiPositionLow then
    Flag=3
    else
    flag=0
    endif
    
    If not ONMARKET and Flag=K1 then  //KK=8
    Buy positionsize contract at market
    EndIf
    
    //IF not ONMARKET and Flag=K1 THEN
    //sellshort positionsize CONTRACT AT market
    //ENDIF
    If longOnMarket AND (BarIndex - TradeIndex) >= K2 Then
    Sell at Market
    Endif
    
    //If shortOnMarket AND (BarIndex - TradeIndex) >= K2 Then
    //exitshort at Market
    //Endif

    goodmorning,

    I’m trying to do a strategy for test, that analyse the position of the body in the Doji candle )high, low or middle) but for some reasons it does not give me any results for test. what I’m doing wrong?

    Dojisize is range of body, for example with K4 from 0,1 to 0,4. DojiPositionHigh is in the high third of the daily candle and DojiPositionLow is in the low third of the daily candle

     

    thanks in advance

     

    Alessio

    #236643 quote
    Aragorna
    Participant
    Junior

    K1 is from 1 to 3

    #236644 quote
    GraHal
    Participant
    Master

    Try using GRAPH on all of your conditions, it is likely that one or more are not ever True?

    GRAPH

    #236645 quote
    GraHal
    Participant
    Master

    Also try below in place of Line 22 …

    if doji and not DojiPositionHigh OR not DojiPositionLow then //OR in place of and
    #236657 quote
    Aragorna
    Participant
    Junior

    I’ve tried but it does not change anything. I’ve seen that DojiPositionHigh and DojiPositionLow are not graphed, but §I don’t understand why

    #236662 quote
    GraHal
    Participant
    Master

    Pick 1 bar and use the actual values of that 1 bar in your calculation for DojiPositionHigh and DojiPositionLow and see if your condition is feasible?

    Just ideas as sometimes (working on our own)we feel like we are going bonkers?? 😉

    #236663 quote
    robertogozzi
    Moderator
    Master

    Append these lines at the end of your code to spot any incorrect value:

    graph doji
    graph DojiPositionHigh coloured("Blue")
    graph DojiPositionLow  coloured("Red")
    #236664 quote
    Aragorna
    Participant
    Junior

    Doji is OK and identified, while the other two no, at least I see only two straight horizontal  lines, one red and one blu, on the zero  and the one position

    #236687 quote
    robertogozzi
    Moderator
    Master

    So you know where the issue is, which makes it a bit easier to work out.

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

Doji strategy Test


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Aragorna @aragorna Participant
Summary

This topic contains 8 replies,
has 3 voices, and was last updated by robertogozzi
1 year, 5 months ago.

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