Timed Exiting when in the Red

Forums ProRealTime English forum ProOrder support Timed Exiting when in the Red

  • This topic has 5 replies, 3 voices, and was last updated 1 month ago by avatarBrad.
Viewing 6 posts - 1 through 6 (of 6 total)
  • #229597

    Good day all

    Can someone please let me know if I have coded this correctly?

     

    • Exit on a Friday if an open trade shows a value of -30 points or less at 21h20 UTC.
    • Exit any open trade with a value of -80 points or less from bar 15 or more.

     

    Regards

    Brad

     

    #229629
    JS

    Hi @Brad

    Your code looks good… It’s just that it’s not an indicator or a trading system right now, so you can’t test the code…

    Customize the code to make it a trading system or an indicator so that you can actually test and assess the code…

    1 user thanked author for this post.
    #229632

    Hi Brad,

    JS is right that it is not easy to see whether a real trading system will work out. However, in advance I think I can say this :

    This may initially not exit when you would have a Pending Stop for this. Thus, at an initial bar which complies to above, the exit may not happen because the price is not met (again, when you’d use a Pending Stop), while at a next bar the condition may not be true any more because the loss is less than 80 again (e.g. 79). And because the construction of your code, CuttingMyLosses will be 0 again and no exit will happen.

    This might be what you want.

    If that is not what you want, you must introduce something like CuttingMyLossesSet. For example :

    This may look overdone too some, but I know how decently you are trying to master (PRT) coding.

    Peter

    1 user thanked author for this post.
    #229722

    Thanks, JS and Peter, for your feedback.

    Looking at the code you supplied, Peter, does the logic remain the same if I write the code like this?

    Am I understanding your coding correctly?

    (You are correct; I’m definitely trying to master/understand code logic to improve my coding).

     

    Regards

    Brad

    #229737

    To me the introduction of lines 3,4,5 looks more decent than without it. But I would have the same remarks as in my previous post. Please remember, those remarks are only valid when you’d use Pending Stops. Compare with this :

    Now all is fine, and/but your CuttingMyLosses variable would do nothing. So that variable urges (in my mind) for something like

    And my previous post would be valid because the order may not be filled and your code will be called again with the position still there.

    What remains is that it is difficult to brainstorm without seeing the full code.
    But I am confident you got the gist already. 🙂

    1 user thanked author for this post.
    #229829

    Great, thanks Peter!

Viewing 6 posts - 1 through 6 (of 6 total)

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