help with code writing

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #7891 quote
    balance
    Participant
    Junior

    Hi,
    I am stage “begins” in programming search engines in your excellent software.

    I wanted to ask, is it possible to ask for such conditions, for example –
    Before 30 bars – for 30 bars, the indicator was less than the “X”?
    If so, how do you write it?

    Now I know that you can ask, for example – before 30 candles – the indicator was less than the “X”
    But I do not know how to ask for it automatically for several days.

    #7895 quote
    Nicolas
    Keymaster
    Master

    Hi balance,

    To do this we have to make a loop in the past to test if your indicator were effectively under the “X” value.

    In this example i’m testing if the RSI over the last 30 bars were below the 50 level:

    count = 0
    myRSI = RSI[14](close)
    
    for i = 0 to 30 do 
     if myRSI[i]<50 then 
      count=count+1
     endif
    next
    
    if count=30 then
     result = 1 
    else
     result = 0
    endif

    I coded this in the forum, haven’t test it, please gimme feedback if it works .. or not 🙂

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

help with code writing


ProScreener support

New Reply
Author
author-avatar
balance @balance Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
9 years, 8 months ago.

Topic Details
Forum: ProScreener support
Language: English
Started: 05/24/2016
Status: Active
Attachments: No files
Logo Logo
Loading...