Close below 50% of the total bar

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #112008 quote
    wizzan123wizzan123
    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
    robertogozzirobertogozzi
    Moderator
    Legend

    There you go:

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

    Thank you Robert!

    #112266 quote
    WilkoWilko
    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.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

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 WilkoWilko
6 years, 11 months ago.

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