GAP DOWN incorrect results.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #95774 quote
    kumar_AK
    Participant
    Junior

    HI There,

    I am using the below code and seems to be getting incorrect results. Wondering why this is happening.

    I am looking for gap downs. I got these two stocks in my scan have no clue why they came in my scan. NAB & PNI.

    I doubt I may be missing the real gaps as well. if some one can help me fixing the code would be appreciatable.

    O H L C
    NAB-5/4/19 24.91 24.95 24.76 24.79
    NAB-8/4/19 24.85 24.89 24.55 24.68
    PNI-5/4/19 5.33 5.39 5.205 5.385
    PNI-8/4/19 5.4 5.57 5.4 5.47

    code:


    // Initialization of Amplitude
    Amplitude = 0.002
    // Initialization of detector
    Detector = 0
    // Gap Down
    // 1st condition of the existence of a gap
    IF High < Low[1] THEN
    // 2nd condition of the existence of a gap
    IF ABS((High – Low[1]) / Low[1]) > Amplitude THEN
    // Behavior of the detector
    Detector = 1
    ENDIF
    ENDIF
    c1  = volume >50000
    c2 = Close > 0.20
    indicator1 = ExponentialAverage[20](close)
    indicator2 = Average[20](close)
    c3 = (indicator1 < indicator2)
    indicator3 = MACDline[12,26,9](close)
    indicator4 = ExponentialAverage[9](indicator3)
    c4 = (indicator3 < indicator4)
    SCREENER[Detector and c1 and c2 and c3 and c4] (LOW[1] AS “% Previous Low “)
    thanks
    #95775 quote
    robertogozzi
    Moderator
    Master

    To write code, please use the <> “insert PRT code” button to make code more readable. Thank you.

    As for NAB, line 9 reports 0.005 which is greater than Amplitude, so it’s ok. Maybe your formula is wrong, what did you mean to achieve with that expression?

    Moreover line 15 is easily higher than 0.20, being 24.68 the closing price. Once again, what was your aim?

    I made a strategy out of your screener. You can backtest it and use GRAPH to spot what value your variables retained at each candle closure (see pic) so that you can easily debug it:

    // Initialization of Amplitude
    Amplitude = 0.002
    // Initialization of detector
    Detector = 0
    // Gap Down
    // 1st condition of the existence of a gap
    IF High < Low[1] THEN
       // 2nd condition of the existence of a gap
       IF ABS((High - Low[1]) / Low[1]) > Amplitude THEN
          // Behavior of the detector
          Detector = 1
       ENDIF
    ENDIF
    c1  = volume >50000
    c2 = Close > 0.20
    indicator1 = ExponentialAverage[20](close)
    indicator2 = Average[20](close)
    c3 = (indicator1 < indicator2)
    indicator3 = MACDline[12,26,9](close)
    indicator4 = ExponentialAverage[9](indicator3)
    c4 = (indicator3 < indicator4)
    //SCREENER[Detector and c1 and c2 and c3 and c4] (LOW[1] AS "% Previous Low ")
    buy at -close limit
    graph ABS((High - Low[1]) / Low[1])
    graph Amplitude
    graph c1
    graph c2
    graph c3
    graph c4
    graph Detector
    x-6.jpg x-6.jpg
    #95893 quote
    kumar_AK
    Participant
    Junior

    Hi RObert,

    thanks for your reply.

    my aim is to find all the stocks open gap down and still gap exists. ( today high is < yesterday low)

    like-2 to line 13 I am expected to filtered  (NAB & PNI)

    My criteria as below:

    1. find stocks that have current gaps today
    2.  today volume is more than 50000
    3.  price is more than 0.20
    4.  EMA 20 > MA20
    5.  MACD is above SIGNAL line

    can you please check my code is meeting my criteria.

    I could have used Amplitude = 0.001

    I increased it to 0.002 to get little bit big gaps.

    thanks

    kumar

    #95902 quote
    robertogozzi
    Moderator
    Master

    Your code is correct, you have just to change line 18, replacing “<“ with “>”.

    Why NAB shouldn’t have been reported? It meets your requirements!

    #95912 quote
    kumar_AK
    Participant
    Junior

    thanks for line 18. I will correct it.

    NAB & PNI both should not be reported reason is below.

    this scan was produced on 8-4-19 (Monday).  Day before is 5-4-19 (Friday).

    NAB do not have gap down on monday. OPEN = 24.85 & HIGH = 24.89 ;  Friday LOW = 24.76  as per line 7 it should be filtered out.

    PNI do not have gap down on Monday. OPEN = 5.40 & HIGH = 5.47 ;  Friday LOW = 5.205  as per line 7 it should be filtered out.

    I expect if  HIGH 24.89 is lower than previous day low (i.e: LOW[1] = 24.76) & PNI.

    please correct me if i am wrong.

    #96048 quote
    robertogozzi
    Moderator
    Master

    Sorry, I can’t fine ant NAB, nor PNI, stock code bot on IG and PRT. Can you provide the name of the company, please?

    Do you have end-of-day data?

    #96071 quote
    kumar_AK
    Participant
    Junior

    NAB —–National Australia Bank

    PNI —Pinnacle Invert Mgmt Grp Ltd

    Both are ASX- Australian stock exchange.

    Screen shots are attached. LAst bar ON right hand side (RHS) belongs today which is 11/4.  we are talking about Monday & Friday bars. That means 4th and 5th from RHS

    pni.png pni.png NAB.png NAB.png
    #96093 quote
    robertogozzi
    Moderator
    Master

    I asked if you have emd-of-day data, but you did not answer.

    I think that is the issue, since you cannot access the MONDAY data, so HIGH refers to friday 5th and LOW[1] refers to Thursday 4th, in which cases it’s ok both for NAB and PNI.

    x-10.jpg x-10.jpg
    #96378 quote
    kumar_AK
    Participant
    Junior

    HI RObert,

    I have checked with IG markets. My account is live account and all my data is live data.

    I have these results on 8th during market open and even after market closed. (late night).

    I have no clue. your logic seems to be correct. both stocks have gap down on 5 th april.

    I will post you if I see more of this type.

    thanks

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

GAP DOWN incorrect results.


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
kumar_AK @kumar_ak Participant
Summary

This topic contains 8 replies,
has 2 voices, and was last updated by kumar_AK
6 years, 11 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 04/09/2019
Status: Active
Attachments: 4 files
Logo Logo
Loading...