Coding Criteria using multiple conditions
Forums › ProRealTime English forum › ProScreener support › Coding Criteria using multiple conditions
- This topic has 5 replies, 2 voices, and was last updated 4 years ago by
Courtney Smith.
-
-
09/28/2020 at 11:30 PM #145782
Pro Screener Questions
System Name Conqueror
So I currently have this system that has 3 conditions. If all three conditions are met we have the count =+3 (we go long) and if all three conditions are not me we have the count=-3(we got short).
I am trying to develop a screener where it will search for when we have the first initial count of +3 or -3 condition.
I am not sure how to code it where the screener looks back to the previous day (maybe use barindex??) to see if we have the count of +1, +2 or -1, -2 then sees that today… we now have the count of +3 or -3. In such that I want to go long or go short on the very first signal not during the middle of the move.
In addition to searching for the first initial criteria of +3 or -3. I want and additional criteria where we use the ADX14 where the slope must be positive to take the trade ie show up in the screener.
I have attached some screen shots of what a good signal and bad signal would be, the PRT indicator and the PRT screener code that I have developed so far.
Any help would be greatly appreciated.
09/29/2020 at 12:33 AM #145790Here is the modified screener, so that it returns only the first signal, with the addition of ADX as a filter:
1234567891011121314151617181920212223242526272829303132333435363738// this is an attempt at finding new +3 and -3 conqueror postionscount=0countb=0MA = Average[10](Dclose(10))cond1= dclose(0)-average[10](close)cond2= average[10](close)-MAcond3= dclose(0)-dclose(40)MyAdx= Adx[14]cond4= MyAdx > MyAdx[1]cond5= MyAdx < MyAdx[1]if cond1>0 thencount=count+1endifif cond2>0 thencount=count+1endifif cond3>0 thencount=count+1endifif cond1<0 thencountb=countb-1endifif cond2<0 thencountb=countb-1endifif cond3<0 thencountb=countb-1endifif ((count=3 AND cond4) or (countb=-3 AND cond5)) thenc1=1elsec1=0endifx = c1IF c1 = c1[1] THEN //make sure not to issue a signal equal to the previous onex = 0ENDIFScreener[x]When attaching files, please attach only:
- ITF files for the ProRealTime platform
- TXT or PDF files for unformatted text
- PDF files for formatted text and documents
- JPG or PNG files for images.
Moreover, when posting ITF (code) files, please post also the source code (using the “Insert PRT code” button to make it easier to read).
Thank you 🙂
10/02/2020 at 2:35 AM #146129Hi Roberto,
Thank you so much for the support. I do have a few more questions. I did make a few modifications to your code that you provided. You can see my comments in the code. But for some reason this isnt working 100% correct all the time. Also I am the person that reached out on August 13 for one on one tutoring. I am almost ready to set up an appointment with you.
The +3 trades seem to work most of the time (see attached screen shots)
The -3 trades dont seem to work as well. (see attached screen shots)
Practice Conqueror Search 31234567891011121314151617181920212223242526272829303132333435363738// this is an attempt at finding new +3 and -3 conqueror postionscount=0countb=0MA = Average[10](Dclose(10))cond1= dclose(0)-average[10](close)cond2= average[10](close)-MAcond3= dclose(0)-dclose(40)MyAdx= Adx[14]cond4= MyAdx > MyAdx[1]//cond5= MyAdx < MyAdx[1] We only want to take trading signals if ADX has postive slope bull or bear trades. ADX is confirming that the trend is "trending". We dont need this part of the code.if cond1>0 thencount=count+1endifif cond2>0 thencount=count+1endifif cond3>0 thencount=count+1endifif cond1<0 thencountb=countb-1endifif cond2<0 thencountb=countb-1endifif cond3<0 thencountb=countb-1endifif ((count=3 AND cond4) or (countb=-3 AND cond4)) then // Cond5 in the second part i changed to cond4c1=1elsec1=0endifx = c1IF c1 = c1[1] THEN //make sure not to issue a signal equal to the previous onex = 0ENDIFScreener[x]10/02/2020 at 6:58 PM #146236I replaced the last line of the screener with:
1Screener[x](Count + Countb AS "Criteria")then I converted it into this indicator:
12345MA = Average[10](Dclose(10))cond1 = dclose(0)-average[10](close)cond2 = average[10](close)-MAcond3 = dclose(0)-dclose(40)RETURN cond1 AS "cond1",cond2 AS "cond2",cond3 AS "Cond3"and it seems to be working fine.
10/04/2020 at 1:09 AM #146299Hi Roberto,
Thank you once again. I added your adjustments to my code. I think I was a little bit vague in my last post.
I am fairly confident in my indicator working correctly, but I am having trouble in the screener itself.
I think we are very close to having it work 100%. I just ran the screener on the predefined list “US NASDAQ Stocks”.
The Screener does produce initial +3 signals correctly most of the time… But for example this stock “FLDM” was listed as a fresh +3 signal, but it is actually the second +3 signal in the string and shouldnt have shown up at all. Thursday Oct 1st was the first +3 day, but the adx was negative so it technically shouldn’t show up in the screener for Oct 1. On Oct 2nd we got another +3 signal and the first day we got a positive ADX. So maybe the order of the code needs to be switched around so the adx is read first?
Also
10/04/2020 at 9:30 PM #146423I was able to figure it out on my own.
Thank you once again. !
Now time to try to get a backtest worked out for this.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on