Using PSAR crossover in short timeframes e.g. 10 minutes

Forums ProRealTime English forum ProOrder support Using PSAR crossover in short timeframes e.g. 10 minutes

  • This topic has 11 replies, 4 voices, and was last updated 1 year ago by avatardruby.
Viewing 12 posts - 1 through 12 (of 12 total)
  • #198153

    Hello,

    I have PRT Complete with IG Index and have completed the first training course. I have tried 50 plus ways to make what seems straightforward happen . . . and failed!

    I’m sorry if on reading this you think well that’s so obvious, but I am as Nicolas puts it, now “dreaming programming code” and I need a solution 🙂

    So here goes:-

    Short timeframe (i.e. 10 minutes) and I am looking for the PSAR to change red to green or vice versa.

    New bar with the new PSAR and if the bar matches the colour of the PSAR then I set a value of HIGH + 2 or LOW – 2 for the next bar to enter the market.

    If no post change bars meet the criteria (HIGH + 2 or LOW – 2) then the cycle starts again on the next PSAR change.

    If a bar equals or exceed the HIGH + 2 or LOW – 2 then a BUY or SELLSHORT is set up with target of 30 and stop of 60.

    If nothing matches or the PSAR and first bar don’t match then all is reset for the next change of the PSAR.

    If the trade is activated but the target or stop is not met then the trade is closed at the open price of the next PSAR change.

    I hope that makes sense, any ideas are really welcome as I am just short of making a truth table and trying each by trial and error … which would be silly, I know?

    Thank you in anticipation,

    #198155

    A kind man may be along to help re coding of above, but until then, did you see this PSAR TS in the Library?

    https://www.prorealcode.com/prorealtime-trading-strategies/dax-parabolic-system/

    It may help to ‘cut your teeth‘ on? 🙂

    1 user thanked author for this post.
    #198159
    JS

    Hi @maleczek

    To start with the “coloured” parabolic SAR…

     

     

    2 users thanked author for this post.
    #198176

    Thank you GraHal,

    I had seen the library code you pointed me to and it operates in the first/second bar but I want to set the High  or the Low  in the first bar of the same colour as the PSAR and then open a BUY or SELLSHORT at MARKET in the following bars – if indeed one of the bars does in fact exceed the HIGH + 2 or come in under the LOW -2 and then wait till it hits TARGET or STOP before the next PSAR change … if it doesn’t hit TARGET then it is closed at OPEN when the PSAR changes.

    I have struggled with the logic of time based as opposed to event/procedural coding …

     

    Thanks again,

    1 user thanked author for this post.
    #198257
    JS

    Hi @maleczek,

    First attempt…

    2 users thanked author for this post.
    #198260

    Just to clarify your spec..

    Let’s say that when the PSAR changes, that this is the first bar, bar 1.

    At the beginning of bar 2, a check can be made to see if there was a change at bar 1.

    On change on bar 1, the PSAR of bar 2 is calculated as normally.

    At the beginning of bar 3, a check can be made to see if bar 2, PSAR and candle colors match.

    If they match, offset bar 2  (HIGH–> green PSAR, or LOW–> red PSAR) before calculating bar 3 PSAR.

     

    Does this look correct so far. I’m stopping here because I don’t understand, ‘ If no post’.

    ‘If no post change bars meet the criteria (HIGH + 2 or LOW – 2) then the cycle starts again on the next PSAR change.’

    I’ve modified The code from JS to identify the 2nd bar candle/PSAR color match, identified with a ‘S’, see pick.

     

    #198274

    Thank you JS and apologies for the delay in replying … my work gets in the way.

    I was ready to give up on Probuilder but on seeing your code get 95% success in such a short time – I realise that I have a lot to learn!!!

    The only ‘5% bit’ that didn’t work was when the HIGH of 32,634.3 of the bar before tha ‘A’ trade (in attached slide) which opened at 32,632.3 instead of  32,636.3  i.e. HIGH + 2    – hope that makes sense?

    Otherwise, it works!!!!

    Thank you again.

     

     

    1 user thanked author for this post.
    avatar JS
    #198277

    Hi druby, Thank you for your reply.

    I have just replied to JS who has ‘conjured up’ some amazing code that seems to almost solve the problem …

    from your response, can I say again that the goal was to clour match the bar and PSAR in the first bar and if matched Green then bar 2 needs to reach HIGH + 2 to open a BUY position.  If the first bar matches RED for both bar and PSAR then the sec ond bar needs to be LOW -2 to open a SELLSHORT position. If the TARGET of 30 or the STOP 0f 60 is not activated then the trade is closed at the change of PSAR.  If the above ‘bar 1’  two conditions are not met i.e. RED PSAR and GREEN BAR or GREEN PSAR and RED BAR then no position is opened.

    Hope that makes sense?

     

     

     

    #198280

    Hi… thanks for your reply,  just processing your comments.

    I’m sure you noticed this, but the  ‘A’ trade you mentioned in reply to JS, which didn’t enter +2 above the previous high as required, actually opened -2 below the previous high. As best I can see that was the same for D and G.

    I’m assuming that your code is modified to get the results you want but not yet 100%. Thought this may be a sign on what’s happening, a -2 instead of a +2 if you follow.

    If i’m way off the mark just ignore.

    #198286

    hi…

    Didn’t realize JS had posted ‘The Code’  based on my comments above and JS’s code shouldn’t line 39  be +2.

    ‘Buy at (High – 2 * pointsize) STOP’.

    Well done JS.

    1 user thanked author for this post.
    avatar JS
    #198298
    JS

    You are right @druby, line 39 should of course be “Buy at (High + 2 * pointsize) STOP”

    #198305

    Just thought JS my ‘well done JS’  comment could be taken more than one way.

    For clarity sake , I was impressed how you provided and then modified the code to provide a solution. I, was still scratching my head!

    All the best.

    1 user thanked author for this post.
    avatar JS
Viewing 12 posts - 1 through 12 (of 12 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login