Same named conditon for different TimeFrames

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #235904 quote
    sgrech
    Participant
    Junior

    You can see in the code below that under both Daily/Weekly timeframes there is a condition with the same name bbUP.  This appears to be causing an issue and I am unsure why?  Basically when I sort by C9 [bbUP], the correct value is returned ie BollingerUP[20](Close) for the daily bar.  HOWEVER when I change bbUP[1], it doesn’t return the value for the previous daily bar but rather the BB for previous weekly bar!!?

    TIMEFRAME(daily)
    
    // def inds
    ma20 = average[20](close)
    bbUP = BollingerUP[20](close)
    
    //ma50 higher than prior day
    c1 = ma20 > ma20[1]
    c8 = high>bbUP
    c9=bbUP[1]
    
    TIMEFRAME(weekly)
    //def inds
    ma40 = average[40](close)
    ma80 = average[80](close)
    ma200 = average[200](Close)
    bbUP = BollingerUP[20](close)
    bbDW = BollingerDown[20](close)
    
    
    //40 period ma (200day ma) trending higher
    c2 = ma40[1] > ma40[3]
    
    //200 period ma trending higher
    c3 = ma200>ma200[5]
    
    #235909 quote
    sgrech
    Participant
    Junior

    Anyone able to provide some much needed insight?

    #235911 quote
    JS
    Participant
    Senior

    Hi,

    You can’t use the same variable name in different time frames, this causes confusion…

    For example, use:

    bbUPDaily

    bbUPWeekly

    sgrech and Iván González thanked this post
    #235912 quote
    sgrech
    Participant
    Junior
    I guessed as much,  I already adjusted the code accordingly.
    JS thanked this post
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Same named conditon for different TimeFrames


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
sgrech @sgrech Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by sgrech
1 year, 7 months ago.

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