oil-10min-hammernegated-pattern-strategy

Viewing 15 posts - 1 through 15 (of 94 total)
  • Author
    Posts
  • #40331 quote
    Francesco78
    Participant
    Master

    Hello everyone, as suggested by Grahal I’m opening a forum thread dedicated to my last posted strategy on oil.

    http://www.prorealcode.com/prorealtime-trading-strategies/oil-10min-hammernegated-pattern-strategy/

    Happy to compare results but most of all to hear your criticism in order to be able to improve in the spirit of this forum.

    Best

    Francesco

    #40341 quote
    Ronny
    Participant
    Veteran

    Hello,

    I was thinking about the division by zero problem running this strategy. I would guess the (high-low) statement below would be the source of the error?

    This was suggested as a correction:

    hammerupnegated= max(open,close)<min(open[1],close[1]) and abs(open-close)/((high-low)*1)>x

    But zero times 1 is still zero i would guess?? An IF-test would fix this, but I was wondering if there was another permanent fix?

    Francesco78 thanked this post
    #40347 quote
    juanj
    Participant
    Master

    I would suggest using

    If (high-low) = 0 Then
    HiLo = 1
    Else
    HiLo = (high-low)
    EndIf
    
    hammerupnegated= max(open,close)<min(open[1],close[1]) and (abs(open-close)/HiLo)>0.5
    #40378 quote
    Kenneth Kvistad
    Participant
    Senior

    I was testing the strategy but also got the Zero Division last night so I have started it again with the fix from Andyswede:

    hammerupnegated= max(open,close)<min(open[1],close[1]) and abs(open-close)/((high-low)*1)>x
    cs = hammerup and hammerupnegated and bear
    hammerdown = max(open[1],close[1])<low[1]+(high[1]-low[1])/3 //and timeok
    hammerdownnegated = min(open,close)>max(open[1],close[1]) and abs(open-close)/((high-low)*1)>x

    And hope it works fine.(have to wait some days since it doesent buy to offen.

    —————————————————————————————

    I have also tested on the backtest with this addition:

    NbrContracts = 2 //need a value for the first trade
    IF PositionPerf(1) < 0 THEN
    NbrContracts = 2
    ENDIF
    IF PositionPerf(1) > 0 and PositionPerf(2) > 0 THEN
    NbrContracts = 3

     

    Buy 3 after second win and buy 2 after first loss.


    I also tested it with some sort of martin gale strategy for fun.

    IF Barindex = ExitIndex + 1 THEN
    ExitIndex = 0
    IF PositionPerf(1) < 0 THEN
    OrderSize = MAX(OrderSize -0.5, 1)
    ELSIF PositionPerf(1) >= 0 THEN
    OrderSize = OrderSize +0.2
    ENDIF
    endif

    jaumeso thanked this post
    positionperf-us-crude.jpg positionperf-us-crude.jpg martin-gale-10min-us-crude.jpg martin-gale-10min-us-crude.jpg
    #40383 quote
    Andyswede
    Participant
    Master

    Hi Kenneth, it  didn´t work, just a little bit longer 🙂 And as Ronny said, it´s still divided by zero, my wrong. I`m trying Juanj:s fix.

    Thanks for your fix Juanj and of course Francesco for really nice strategy 🙂

    Andy

    #40385 quote
    Kenneth Kvistad
    Participant
    Senior

    Is this the same as you are trying Andyswede?

    If (high-low) = 0 Then
    HiLo = 1
    Else
    HiLo = (high-low)
    EndIf
    
    
    hammerup = min(open[1],close[1])>high[1]-(high[1]-low[1])/3 //and timeok
    hammerupnegated= max(open,close)<min(open[1],close[1]) and (abs(open-close)/HiLo)>0.5
    cs = hammerup and hammerupnegated and bear
    hammerdown = max(open[1],close[1])<low[1]+(high[1]-low[1])/3 //and timeok
    hammerdownnegated = min(open,close)>max(open[1],close[1]) and (abs(open-close)/HiLo)>0.5
    cl = hammerdown and hammerdownnegated and bull
    #40386 quote
    Andyswede
    Participant
    Master

    Yes Kenneth, that´s the one, my fix stopped this morning

    #40387 quote
    Kenneth Kvistad
    Participant
    Senior

    So this last update from Juanj might work ?

    Anyway we cant give up now. Fransisco78`s strategy seems Very good:) Thanx again.

    Francesco78 thanked this post
    #40457 quote
    miguel33
    Participant
    Senior

    To me this morning did not do any operation

    #40461 quote
    miguel33
    Participant
    Senior

    Francesco puoi darmi un tuo indirizzo mail , ho bisogno di chiederti una cosa… se vuoi ovviamente. Grazie.

    EDIT: NO EMAIL PLEASE

    PLEASE SPEAK ENGLISH IN ENGLISH FORUM!

    #40546 quote
    Francesco78
    Participant
    Master

    hi guys, thank you for the work you are doing, I did not have this division by zero problem, but maybe you could just try to modify the formula like this

    max(open,close)<min(open[1],close[1]) and abs(openclose)/((highlow+0.0000001))>x?

    Doesnt change the idea underlying idea and should work as a trick?

    Best

    jaumeso thanked this post
    #40572 quote
    Kenneth Kvistad
    Participant
    Senior

    Thats great.I will test this:)

    jaumeso thanked this post
    #40573 quote
    miguel33
    Participant
    Senior

    Kenneth or Francesco ,

    You can describe the conditions, i want to try to im metatrader and see the differences.
    Thank you for your contribution.

    mik

    #40586 quote
    Carras
    Participant
    Junior
    //TRAILING STOP
    TGL =18
    TGS= 24
    if not onmarket then
    MAXPRICE = 0
    MINPRICE = close
    PRICEEXIT = 0
    ENDIF
    if longonmarket then
    MAXPRICE = MAX(MAXPRICE,close)
    if MAXPRICE-tradeprice(1)>=TGL*pointsize then
    PRICEEXIT = MAXPRICE-TGL*pointsize
    ENDIF
    ENDIF
    if shortonmarket then
    MINPRICE = MIN(MINPRICE,close)
    if tradeprice(1)-MINPRICE>=TGS*pointsize then
    PRICEEXIT = MINPRICE+TGS*pointsize
    ENDIF
    ENDIF
    if onmarket and PRICEEXIT>0 then
    EXITSHORT AT PRICEEXIT STOP
    SELL AT PRICEEXIT STOP
    ENDIF

     

    Hi

    Being new to coding, Am I correct in thinking that there is no stop if the price moves immediately against any new trade position? (either long or short).

    Also i’d be interested in hear how you decided on TGL = 18 and TGS = 24 ?

    Many thanks

    #40597 quote
    Kenneth Kvistad
    Participant
    Senior

    MIGUEL33 what you are asking for is a question for francesco78.

    Carras: if price goes directly againt target after taken there is no stop loss. Tgl and tgs is only active is price moves xx pips in righ direction. Then the stop will move accordingly to price. Lets say price goes 50pips, then stoploss will be 18 or 24 pips behind/under.

     

    Why 18 and 24 is something francesco78 have coded after his toughts. I use 30 and 20 or so. Slight diffrens.

    If you whant/should after my opinion i use own code for stop loss just incase it goes directly in wrong direction, I use this code as my last rung/line in the code.

     

    Set stop ploss xx (I use 110pip)

    Carras thanked this post
Viewing 15 posts - 1 through 15 (of 94 total)
  • You must be logged in to reply to this topic.

oil-10min-hammernegated-pattern-strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 93 replies,
has 25 voices, and was last updated by nonetheless
6 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/11/2017
Status: Active
Attachments: 16 files
Logo Logo
Loading...