Positive integer field expected with Lowest

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #158201 quote
    Monochrome
    Participant
    Senior

    Getting a error saying positive integer expected with lowest.

    //P1 = 10
    //P2 = 100
    
    Dindex = ((exponentialaverage[P1](close)-exponentialaverage[P2](close))/exponentialaverage[P2](close))*100
    
    IF DINDEX CROSSES OVER 0 THEN
    FLAG1 = BARINDEX
    ENDIF
    IF DINDEX CROSSES UNDER 0 THEN
    FLAG1 = 0
    ENDIF
    IF DINDEX => 0 THEN
    A1 = HIGHEST[BARINDEX-FLAG1](DINDEX)
    ELSE
    A1 = 0
    ENDIF
    
    a20 = barindex-flag1
    flag2 = 0
    for a = 0 to a20-1
    if dindex[a] = a1 then
    flag2 = barindex[a]
    break
    endif
    next
    
    IF DINDEX => 0 THEN
    //A1AA = MAX(0,DINDEX)
    A1A = LOWEST[BARINDEX-FLAG2](DINDEX)
    ELSE
    A1A = 0
    ENDIF
    
    stochlow = LOWEST[BARINDEX-FLAG2](DINDEX)
    stochhigh = HIGHEST[BARINDEX-FLAG1](DINDEX)
    
    stochbuy= max(0,((dindex-stochlow)/(stochhigh+stochlow))*100)
    
    RETURN stochbuy

    I dont understand the problem can someone help me please

    Thankyou

    #158209 quote
    robertogozzi
    Moderator
    Master

    Replace part of lines 13, 29, 34 and 35 with:

    HIGHEST[max(1,BARINDEX-FLAG1)](DINDEX)
    LOWEST[max(1,BARINDEX-FLAG2)](DINDEX)
    Monochrome and umrk thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Positive integer field expected with Lowest


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Monochrome @monochrome Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
5 years ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 01/17/2021
Status: Active
Attachments: No files
Logo Logo
Loading...