Circular reference

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #125138 quote
    Peter Kisell
    Participant
    Junior

    I’m trying to code a screener for demand and supply levels. I have successfully made indicators and I now want to screen markets.

    I have made two functions that I call and each of them works separately in separate screeners. However. When I try to merge these two screeners into one I get a circular reference.

    I have attached the code that works. But as soon as I uncomment the code underneath it gives me circular reference. I can’t figure out why.

     

    MaxCandleIterations = 200
    CurrentCandleIndex = 1
    ValueToReturn = -1
    
    WHILE CurrentCandleIndex < MaxCandleIterations
    
    // Check for demand.
    IF (OPEN > CLOSE) THEN
    
    Demand, DemandBottom, DemandTop = CALL "Demand zone"[CurrentCandleIndex]
    
    // Buy signal here.
    IF (Demand = 1 AND LOW < DemandTop AND LOW > DemandBottom) THEN
    
    ValueToReturn = 1
    BREAK
    ENDIF
    
    // Check for supply.
    ELSE
    
    Supply, SupplyBottom, SupplyTop = CALL "Supply zone"[CurrentCandleIndex]
    
    // Sell signal here.
    IF (Supply = 1 AND HIGH > SupplyBottom AND HIGH < SupplyTop) THEN
    
    ValueToReturn = 0
    BREAK
    ENDIF
    
    //IF (Supply = 0 AND HIGH > SupplyBottom AND HIGH < SupplyTop) THEN
    
    // Just iterate one more candle to make sure demand isn't hiding behind.
    //Supply, SupplyBottom, SupplyTop = CALL "Supply zone"[CurrentCandleIndex + 1]
    
    //IF (Supply = 0) THEN
    //BREAK
    //ENDIF
    //ENDIF
    ENDIF
    
    CurrentCandleIndex = CurrentCandleIndex + 1
    WEND
    
    
    IF (ValueToReturn > -1) THEN
    SCREENER (ValueToReturn AS "Zone")
    ENDIF
    #125356 quote
    Peter Kisell
    Participant
    Junior

    Let’s see if I can clarify something 🙂

    I have functions that I have created that both works fine and return 3 different values.

    I have no idea why this gives me circle reference as soon as I uncomment the row: //Supply, SupplyBottom, SupplyTop = CALL “Supply zone”[CurrentCandleIndex + 1]

    Anyone have any ideas at all?

    #125369 quote
    Nicolas
    Keymaster
    Master

    What do you mean by getting circular reference with the code please?

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

Circular reference


ProScreener: Market Scanners & Detection

New Reply
Author
Summary

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

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 04/07/2020
Status: Active
Attachments: No files
Logo Logo
Loading...