Close below 50% of the total bar

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #112008 quote
    wizzan123
    Participant
    New

    Hello!

     

    I was wondering how to code a condition for short: I want the the close to be in the bottom 50% of the total bars range.

    Any ideas?

    Regards

    #112021 quote
    robertogozzi
    Moderator
    Master

    There you go:

    IF close <= (high - (range / 2)) THEN
       SELLSHORT AT MARKET
    ENDIF
    #112032 quote
    wizzan123
    Participant
    New

    Thank you Robert!

    #112266 quote
    Wilko
    Participant
    Senior

    Interesting how one differs from the other. The result is the same but I would write that code snippet this way:

    IF close <= low + Range * 0.5 THEN
       SELLSHORT AT MARKET
    ENDIF

    If I want to only sell short if it is in the bottom 10% I merely replace 0.5 with 0.1. This makes it very easy to run optimizations and find out if there is different edge in different percentages.

    I’m not saying that one is better than the other, just that there are more ways than one to skin a cat.

     

    /F

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

Close below 50% of the total bar


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
wizzan123 @wizzan123 Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by Wilko
6 years, 3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/04/2019
Status: Active
Attachments: No files
Logo Logo
Loading...