Automated trading with Pivot Points and Dojis

Viewing 15 posts - 16 through 30 (of 85 total)
  • Author
    Posts
  • #70299 quote
    cgraubner
    Participant
    Junior

    That sounds like a good tactic, I will try this;)

    The T comes from “Tag” and stands for day in german. So basically Piv T and Piv D should be the same.

    GraHal thanked this post
    #70301 quote
    GraHal
    Participant
    Master

    Ha, nice one! language barrier again! 🙂

    So next we need to determine if …

    Piv D/T is todays / current day H+L+C/3 and so Piv changes as the day’s price moves on?

    OR or as you have coded in your System

    Pivot = (DHigh(1) + DLow(1) + DClose(1)) / 3 … which is yesterday’s price levels??  

    cgraubner thanked this post
    #70302 quote
    cgraubner
    Participant
    Junior

    I wanted to use yesterday’s price levels. This is also how the pivot indicator is calculated, I guess.

    #70310 quote
    cgraubner
    Participant
    Junior

    I change to code from “set target” to “exitshort” and “low crosses under pivot”. However, this is not exactly as I planned, because now the exit is triggered not immediatly but rather at the open of the new candle.

    IF shortonmarket and low crosses under pivot then
    exitshort size contract at market
    
    ENDIF

    So apparently the Pivot lines must be identically with the Pivot lines from the chart since the exit is triggered as you can see in the picture.

    Last but not least there is still the problem with the range. The program does not seem to recognise that condition.

    working.png working.png
    #70313 quote
    GraHal
    Participant
    Master

    now the exit is triggered not immediatly but rather at the open of the new candle

    I’ve been out for a family meal so coming at with a fresh mind, what happens if you try …

    If bearishr1 Then
    SellShort size Contract at Market
    Exitshort at pivot stop
    Endif
    cgraubner thanked this post
    #70316 quote
    cgraubner
    Participant
    Junior

    This did not change that much. But I figured out, that the system is better off without any stops at the pivot lines. So right now I let it roll until a candle with higher highs or lower lows develops;)

    Do you have any idea what we can do about the entry within the range of +- 4 points to the pivot lines?

    #70328 quote
    GraHal
    Participant
    Master

    dojisize = 4.2*pipsize

    doji = Range >= ABS(Open[1] – Close[1]) * dojisize

    What Market are you trading on? (good to name the market at top of your code, then easy to find)  Try *pipsize as above?

    Also enter GRAPH  Range >= ABS(Open[1] – Close[1]) * dojisize at the bottom of yuor code and then backtest.

    How many times do you see Range >= ABS(Open[1] – Close[1]) * dojisize during the backtest period??

    #70344 quote
    cgraubner
    Participant
    Junior

    I’m trading on the DAX. For a period of 100 I see 333 times to range and 9 times a trade was triggered. Does that mean the code is working after all?

    #70346 quote
    GraHal
    Participant
    Master

    Try

    GRAPH (close[1] <= r1+4 and close[1] >= r14) and close<low[1])

    and where that lines up with

    GRAPH Range >= ABS(Open[1] – Close[1]) * dojisize

    then you have all conditions to trigger a SellShort = TRUE. Does that equal 9 times?

    #70348 quote
    cgraubner
    Participant
    Junior

    When I try “GRAPH (close[1] <= r1+4 and close[1] >= r14) and close<low[1])” I get an error report for some reason:( The programm does not let me do that, why is that?

    #70350 quote
    GraHal
    Participant
    Master

    Try GRAPH bearishr1

    cgraubner thanked this post
    #70357 quote
    cgraubner
    Participant
    Junior

    This worked. I graphed all Pivot lines and there seems to be an issue with the timeframe. For instance look at the picture. It says, that the doji was developed within the range of the R3 line, but the R3 line is way too far away. What could be the reason for this?

    timeframe.png timeframe.png
    #70374 quote
    GraHal
    Participant
    Master

    It be good if you copy the code you are commenting on as it will save me having to go back (to page 1 of this Thread etc) and guess / search for which bit of code you are commenting on? 🙂

    #70375 quote
    cgraubner
    Participant
    Junior

    Ok, I aligned the two time frames. I created an indicator with the pivot lines and displayed them into the chart. As you can see they are now equal. But I changed my prefered Pivot point settings. I want the pivot points only to consider a daily time frame from the opening at 9:00 till the closing at 17:30. How can I change the settings within the code so the pivot points only considere this time frame?

    timeframe-2.png timeframe-2.png
    #70377 quote
    cgraubner
    Participant
    Junior
    //DAX
    
    DEFPARAM CumulateOrders = false
    DEFPARAM FlatBefore = 090000
    DEFPARAM FlatAfter = 171500
     
    Pivot = (DHigh(1) + DLow(1) + DClose(1)) / 3
    R1 = 2*Pivot - DLow(1)
    S1 = 2*Pivot - DHigh(1)
    rR2 = Pivot + (DHigh(1) - DLow(1))
    S2 = Pivot - (DHigh(1) - DLow(1))
    R3 = R1 + (DHigh(1) - DLow(1))
    S3 = S1 - (DHigh(1) - DLow(1))
     
    dojisize = 4.2
    doji = Range >= ABS(Open[1] - Close[1]) * dojisize
     
    bearishr1 = (doji and (close[1] <= r1+4 and close[1] >= r1-4) and close<low[1])
     
    stoplownextcandle = low<low[1]
    stoplowdoji = low>low[1]
     
    stophighdoji = high<high[1]
    stophighnextcandle = high>high[1]
     
    size = 30
    stopbull = 2
    stopbear = 2
     
    If bearishr1 Then
     
    SellShort size Contract at Market
     
    Endif
     
    if shortonmarket  and stophighnextcandle then
    set stop ploss (high+stopbear)
    endif
     
    if shortonmarket  and stophighdoji then
    set stop ploss (high[1]+stopbear)
    endif
     
    IF shortonmarket  and (close >high[1]) then
    exitshort size contract at market
     
    ENDIF
    

    Here is the current code with the R1 line as an example.

Viewing 15 posts - 16 through 30 (of 85 total)
  • You must be logged in to reply to this topic.

Automated trading with Pivot Points and Dojis


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
cgraubner @cgraubner Participant
Summary

This topic contains 84 replies,
has 5 voices, and was last updated by robertogozzi
7 years, 9 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/07/2018
Status: Active
Attachments: 25 files
Logo Logo
Loading...