help coding missed pivot strategy

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #160761 quote
    ullle73
    Participant
    Senior

    Hi,

     

    on MT4 ive used a statistic indicator showing price almost never misses two pivots in a row in forex. I need help coding a strategy that takes a position towards pivot when last day missed pivot. And todays open is at least 10 pips away from todays pivot. SL X, target PP or Y

    #160767 quote
    Nicolas
    Keymaster
    Master

    So that mean: if yesterday the price didn’t cross the pivot line, take an order today when it will cross the current pivot?

    #160871 quote
    ullle73
    Participant
    Senior

    sorry no, an example:

    1.  Yesterdays OPEN is above yesterdays pivot
    2. Yesterdays Low is higher then yesterdays pivot (did not hit pivot)
    3. Todays OPEN is higher then todays pivot
    4. Take a short towards todays pivot.
    5. Set TP and SL to x and y pips (or if possible, set TP todays pivot with equal distance SL 1:1 RR)
    #160945 quote
    Nicolas
    Keymaster
    Master

    ok, so I think that code should be correct for this strategy:

    defparam cumulateorders=false
    timeframe(daily)
    pivot=(high[1]+low[1]+close[1])/3
    pivot1=(high[2]+low[2]+close[2])/3
    c1 = open[1]>pivot1 and low[1]>pivot1
    c2 = open>pivot
    iopen1=open[1]
    ilow1 = low[1]
    
    timeframe(default)
    if intradaybarindex=0 then 
    trade=1
    endif 
    
    if c1 and c2 and trade then 
    sellshort 1 contract at market 
    set target profit close-pivot 
    set stop loss close-pivot 
    trade = 0
    endif 
    
    graph c1
    graph c2
    graphonprice pivot1 coloured(0,200,200)
    graphonprice pivot coloured(200,200,0)
    graphonprice iopen1
    graphonprice ilow1
    
    
    ullle73 thanked this post
    #161369 quote
    ullle73
    Participant
    Senior

    Thanks alot nicolas!!

     

    is line 18 correct? looks the same as TP. Nicolas, could you also add in the long? same rules. And also add an alternate TP and SL criteria. A fixed pip like “//set stopp loss x pips” and “//set target profit y pips”

     

    Thanks again!

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

help coding missed pivot strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
ullle73 @jonas_rydqvist Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by ullle73
5 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/09/2021
Status: Active
Attachments: No files
Logo Logo
Loading...