highest value

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #15253 quote
    Abz
    Participant
    Veteran

    hello

    when using Dhigh(10) does this return the highest value 10 days ago or the highets value within 10 days? im looking for a variable that looks for the highest within a ceratin periode of time.

    #15256 quote
    H_kan
    Participant
    Senior

    It will return the highest value 10 days ago.

    For the highest value within the 10 latest days:
    Newhigh=0
    FOR i = 0 TO 10 DO
    IF DHigh(i)>Newhigh THEN
    Newhigh = DHigh(i)
    ENDIF
    NEXT

    Nicolas and Abz thanked this post
    #15268 quote
    Abz
    Participant
    Veteran

    if i want to check for highest candle 14 days back on a 5 min chart is this correct to tuse?

    //-------------------------------------------------------------------------
    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    DEFPARAM FLATBEFORE = 080000
    DEFPARAM FLATAFTER = 220000
    Newhigh=0
    FOR i = 0 TO 4032 DO
    IF DHigh(i)>Newhigh THEN
    Newhigh = DHigh(i)
    ENDIF
    NEXT
    c13 = Time < 170000
     
    // Conditions to enter Long positions
    c1 = close >  Newhigh
    IF not onmarket AND c13 AND c1 THEN
    sellshort 2 SHARES AT MARKET
    SET STOP pLOSS 25
    SET TARGET pPROFIT 25
    ENDIF

     

    #15291 quote
    Nicolas
    Keymaster
    Master

    You don’t need to use 4032 periods lookback, since the daily OHLC can be retrieve from any timeframe with Dhigh, Dlow, etc..

    The solution H_kan gave you is a good one, you just need to replace “10” by “15” to make the loop 15 days back. H_kan could confirm too 🙂

    #15387 quote
    H_kan
    Participant
    Senior

    Yes. It works like Nicolas says. DHigh always picks the highest daily value undependently of which timeframe you use. If you use 4032 in your code it will look 4032 days back!

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

highest value


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Abz @abbas_sadiq Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by H_kan
9 years, 3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 10/21/2016
Status: Active
Attachments: No files
Logo Logo
Loading...