Announcement

Collapse
No announcement yet.

Parabolic SAR

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Parabolic SAR

    I used the following code to back test using Par Sar and moving averages. I found that testing for the signal to go from 'Long' to 'Short' strategy (the 'else if' part of 'main'), the value of the Par Sar is not factored into the logic. Any guidance as to what I maybe doing wrong?


    Thanks for the advise
    Attached Files

  • #2
    Mik
    You are missing a bar index inside xPSAR.getValue() which should be xPSAR.getValue(0)
    Alex

    Comment


    • #3
      Dear Alex,

      Thanks for your prompt response, it was much appreciated and it did solve the problem. I have now progreessed onto bigger and not some much better (yet) stuff, need your advise. I am attempting to code Profit Targets into the program. You will notice that just after the PAR Sar code there are lines of code that check if we are trading and what direction, then attempt to close the trade if target reached else progress on to check for conditions to enter trades. However, this is not quiet happening. Would appreciate your input. Would alos appreciate input about how to setup selling 50% of Lotsize at target only rather than all is it just 50% of LotSize as a parameter?

      Thanks,

      Mik
      Attached Files

      Comment


      • #4
        Mik
        You are missing the parenthesis () in some instances of Strategy.isLong() or Strategy.isShort()
        See if that fixes the issue you are having. If it does not then post again to this thread and someone may be available to provide further guidance
        Alex

        Comment

        Working...
        X