Unbroken highs
Forums › ProRealTime English forum › ProScreener support › Unbroken highs
- This topic has 11 replies, 4 voices, and was last updated 6 years ago by robertogozzi.
-
-
12/21/2016 at 12:38 PM #18915
Hello all,
Suppose I have an indicator that I use to generate entry signals. This indicator has the value of 1 when the signal is active and 0 when no signal exists.
How do I create a screener that looks for stocks where the high of the week in which the BUY SIGNAL indicator flashed a signal has not been violated? In other words, if a BUY SIGNAL appeared, say, 15 weeks ago, then every week since then has had a lower high.
Here’s what I’ve coded:
1234567891011121314myBUYSIGNAL = CALL "BUY SIGNAL"FOR i=0 to 20 DOIf myBUYSIGNAL[i] >= 1 thensignal=high[i]elsesignal=0endifc1= highest[high](i) >= signalNEXTSCREENER [c1]I’m getting the following message: “An error has occurred during the execution of your ProScreener market scan”.
Your assistance on this would be extremely helpful.
Thank you,
Igor12/21/2016 at 3:16 PM #1892212/21/2016 at 5:46 PM #18937Hi GraHal,
The code is as follows:
1234567891011c1= low<=1.02*Average[10](Close) and close>=Average[10](close)c2= close>=100IF AverageTrueRange[1](close)>=1.25*Average[20](AverageTrueRange[1](close)) AND Volume>=1.25*Average[20](Volume) AND close>open AND high>=highest[52](high)*0.95 and c1 and c2 THENBUYSIGNAL = 1ELSEBUYSIGNAL=0ENDIFRETURN BUYSIGNALThanks in advance.
Igor
12/22/2016 at 2:02 PM #18981Any suggestion from anyone?
12/22/2016 at 2:41 PM #1898212/22/2016 at 3:02 PM #18983I’m only saying above as that was what flashed in my mind when I read your posts and code. Above may spark some further thoughts in your mind.
I’ll come back if I have any more ideas re your requirement. I’m having a ‘motivation crisis’ today, but nothing serious 🙂
01/08/2018 at 4:31 PM #57767Hi from8to800,
Did you find the solution to your problem?
I’m seeing the same message some times…
Thank you, and good luck!
01/08/2018 at 8:01 PM #57807Here’s what I’ve coded:
123456789101112131415myBUYSIGNAL = CALL “BUY SIGNAL”FOR i=0 to 20 DOIf myBUYSIGNAL[i] >= 1 thensignal=high[i]elsesignal=0endifc1= highest[high](i) >= signalNEXTSCREENER [c1]I’m getting the following message: “An error has occurred during the execution of your ProScreener market scan”. Your assistance on this would be extremely helpful. Thank you, Igor
Your variable SIGNAL may only have value 1 ONLY when myBUYSIGNAL[20], i.e. the last iteration, will be true, else… it will ALWAYS be ZERO even if the first iterations were all true!
Moreover,
1highest[high]will be expanded, at scan time, to, say
12highest[1.1960] //in case you trade Eur/Usdhighest[13960] //in case you trade DAXand will almost always generate an error!
Roberto
1 user thanked author for this post.
01/08/2018 at 11:05 PM #57816Hi everyone, and thank you Roberto for your kind atention. I’m afraid I don’t completely understand your explanation.
I’m having the same error as ‘from8to800’ but, surprisingly my code fails just some times. Most times, it works fine. I don´t think its a network problem, because it fails always with the same stocks (for example, it fails if you try to backtest OTEX with 3000 bars)
The strategy tries to catch high capitalization breakouts, and I’m trying to optimise two variables: ‘volatilidad’ from 2 to 8 (step=3) and ‘misumacap’ from 100 to 300 (step=50).
Thanks in advance,
Miguel
breakout with high capitalization strategy123456789101112131415161718192021222324252627282930313233343536373839404142434445DEFPARAM cumulateorders=falseCapital = 100000Risk = 1REM Calculate contractsequity = Capital + StrategyProfitmaxrisk = round(equity*(Risk/100))riesgo=(priceopen-stoploss)*2cap=volume*typicalpricesumacap=summation[5](cap)sumacap25=summation[25](cap)media5=sumacap25/5supermediacap=100*sumacap/media5//vola=ABS(highest[5](high)-lowest[5](low))*100/typicalpricealto=highest[5](high)bajo=lowest[5](low)vola=ABS(alto-bajo)*100/typicalprice//semana y día alcistaif vola>=volatilidad and supermediacap>=misumacap and close>open[5] and close>open thencondicion1=1elsif condicion1[1]>0 and condicion1<5 and low>stoploss thencondicion1=condicion1[1]+1elsecondicion1=0endifif condicion1=1 thenpriceopen = alto+((alto-bajo)*(5/100))stoploss = bajo-((alto-bajo)*(5/100))riesgo=(priceopen-stoploss)*2PositionSize = abs(round(maxrisk/riesgo))endifif condicion1>0 thenBUY positionsize shares at priceopen stopendifGRAPH supermediacap coloured (0,200,0,255) as "supermediacap"GRAPH vola coloured (0,100,100,255) as "volatilidad"SET TARGET PROFIT riesgoSET STOP LOSS riesgo01/09/2018 at 12:40 AM #57834@vitatrader35, this a ProScreener support forum, if you want to talk about a strategy you should open a new topic in the ProOrder Support Forum. Thank you.
I’m afraid I don’t completely understand your explanation
Let me know what it is, so I can try to explain it better. I was just pointing out a couple of logic errors, I did not mean to correct the code at all, since I did not understand exactly what from8to800 was trying to accomplish.
01/09/2018 at 11:18 AM #57879Hi, Robertogozzi
I just posted here because yours is the only explanation I found to this kind problem. I read your message more carefully and now I think I understand. Thank you, because I think you opened the way to find the solution (its more than possible that my code has one -or more- logic problem…). I’ll try to make the question in the right place.
One more question, about the original post: could this also be an error?
(wrong)
c1= highest[high](i) >= signal
(righ, if all the iterations were positive)
c1= highest[i](high) >= signal
Thank you for your help
01/09/2018 at 1:16 PM #58590Yes vitatrader35, that would work finely!
But be aware that
1c1= highest[high](i) >= signalwhen signal IS zero will be expanded, at scan time, to
1c1= highest[high](i) >= 0thus making c1 TRUE!
I don’t know if this logic behaviour is unwanted or not, I just pointed it out.
1 user thanked author for this post.
-
AuthorPosts