Lowest/Highest Low/High

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #140460 quote
    Johann
    Participant
    Average

    Hi PRC Team,

    I want to measure my target profit from the highest high or lowest low as measured after the trade and not from the entry price. I tried the following but it did not work:

    If (highest[barindex - tradeindex](high)) - close >= 50 Then
    Exitshort at market
    Endif
    If close - (lowest[barindex - tradeindex](low)) >= 50 Then
    Sell at market
    Endif
    #140474 quote
    robertogozzi
    Moderator
    Master

    CLOSE moves every bar, so it can’t work!

    You’ll have to replace CLOSE with TradePrice to make it work.

    Moreover, you may happen to be reported an error because HIGHEST and LOWEST may have 0 as a lookback number.

    I suggest that you replace the above code with:

    If ShortOnMarket AND (highest[max(1,barindex - tradeindex)](high)) - close >= 50 Then
       Exitshort at market
    Endif
    If LongOnMarket AND close - (lowest[max(1,barindex - tradeindex)](low)) >= 50 Then
       Sell at market
    Endif
    Johann thanked this post
    #140530 quote
    Johann
    Participant
    Average

    Thanks Robertogozzi,

    I will try and see how it will work, I also thought I can try the following:

    If Longonmarket and Close>=(Lowest[Barindex-TradeIndex](Low) +5 0) Then
    Sell at Market
    Endif
    If Shortonmarket and Close <= (Highest[Barindex-TradeIndex](High) - 50) Then
    Exitshort at Market
    EndIf
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Lowest/Highest Low/High


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Johann @johann Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Johann
5 years, 7 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/30/2020
Status: Active
Attachments: No files
Logo Logo
Loading...