number of periods

Viewing 5 posts - 1 through 5 (of 5 total)
  • #226818

    Good morning all

    I have a proscreener in which I check various timeframes for the last 5 periods please see attached)

    What I am wanting to do is check back over the overnight data, say the last 4 hours. Is it possible to code so that the 10 minutes checks 24 periods, the 5 minutes 48 periods etc etc without having to write the periods as follows [1] thru to [24] and [1] and [48], is it possible to place one line of code that ensures all the periods are checked?

    s6 = (indicator6[1] < 0)
    s7 = (indicator6[2] < 0)
    s8 = (indicator6[3] < 0)
    s9 = (indicator6[4] < 0)
    s10 = (indicator6[5] < 0)

    Appreciate your help as always guys

    Chris

    #226882

    Hi,

    you can reach desired outcome by using the summation instruction to check how many times a condition was true over your chosen number N of candles. For example with N=24:

     

    For CN to equal 1 (true), this summation of BasicCondition over N candles must be equal to N, it necessarily means BasicCondition was true each time. Therefore with this example for N=24, you succeed checking this without writing 24 lines for each time.

    You may be wondering “hey, but that’s only for indicator6[1], where are the others [2], … [24]?”, well it is for [1] as seen from each of the N candles, not as seen from current candle only, so it does cover the 24 occurences.

    You can also write =(summation[24](BasicCondition)=24) if you prefer, using a separate variable N is not necessary, it’s just more convenient when you change the value. Also works this syntax:  summation[24](indicator6[1]<0)=24

    #226893

    Hi JC Bywan

    First of all many thanks for taking the time to offer your expertise.

    If you take a look at the attached, if I have interpreted your instruction correctly then this screener attached should have delivered a number of signals on the GBP/EUR using the indicators also attached.

    I’d appreciate any advise you are able to offer.

    Many thanks in anticipation.

     

     

    #226942

    Hi,

    Not fixing something, but just simplifying the screener code in its use of keyword “timeframe” and also avoiding unneeded duplicated calls by grouping them where the “ignored” are not needed : for example with first part of above file code about timeframe (5 minutes), this:

     

    can be written as:

     

    You can do the same kind of rewriting for the other timeframes in your screener .itf code.

     

    If you obtain nothing out of the screener in your selected list, and know of at least one asset which should have been returned, after checking it does belong to selected list(s), you can visualise in an indicator derived from screener and applied to this asset all conditions s6 to s13 and b6 to b13 by having each one of them in the return line, to see which ones are true and which ones are not. And if one isn’t true when you thought it should be, you can find out why by looking at relevant indicatorX[1] series behaviour.

    #227437

    Hi JC Bywan

    Apologies for not coming back to you sooner to say thank you but for some reason I couldn’t get any signals, I therefore played around with the code a little, for example….

    summation[24](indicator6[1]<0)=24, this was delivering no signals until I removed the “=24” from the end, it then started to work.

    Also this code delivered no signals…

    TIMEFRAME(5 minutes)
    indicator6, indicator8 = CALL “123v2”[70, 30, 14](close)
    s6 = summation[48](indicator6[1]<0)=48
    b6 = summation[48](indicator8[1]>0)=48
    indicator7, indicator9 = CALL “123 Bolly / RSI”[70, 30, 14](close)
    s7 = summation[48](indicator7[1]<0)=48
    b7 = summation[48](indicator9[1]>0)=48
    So I reverted to the original. I may well be doing something clearly wrong, however the code is now working, I can look back much further and all seems to be working a treat.
    Many many thanks for your help and advise, I’m most grateful

     

     

Viewing 5 posts - 1 through 5 (of 5 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login