PerParticipant
Average
Request for assistance, after unsuccessful search in manuals etc.
My challenge: As screening for triggers in real time (week & daily charts), the result list findings/triggers from the past which is not interesting.
As I am using the screener to notify me for trigger to trade in present (now), I have the following Question: How can the results/findings be limited to present covering the bars involved, (as for indicators >defparam DRAWONLASTBARONLY = TRUE) to apply screeners to pop up my triggers in the list as they comply with my criteria’s in present only?
Help will be appreciated with thanks.
See enclosed list where triggers listed are obsolete, days and week back in time! (note. the clock column is the time when screener started this morning)
Per Hovden
The results you get from the screener window depend of your code. If you flag a variable to 1 because your conditions are met, you also need to set it to 0 when they are not, otherwise at the end of the history load, the result will still be true and you’ll get old results.
PerParticipant
Average
Thanks Nicolas,
Based on your reply, I reviewed a few screeners presented on this site and found examples of | Variable: else > Position = 0 | This is aligned with my code, however I am not sure if I interpret correctly?
For simplicity, if you have an example code it will be helpful or simply add it to the code. Whatever is to your preference.
Tanks again.
Per
My code:
REM Turning Candle formation with Bollinger B on steroids (high/low pivots)
//General
myBollUp = Average[11](close)+1.5*std[11](close)
myBollDn = Average[11](close)-1.5*std[11](close)
//Long
if ADX[7] > 50 then // High ADX level = iminent change
if open[1] > close[1] then // Red candle [1]
if low[1] < myBollDn then // Yesterday low, outside BB
if open[0] > Low[1] then // Today open > yesterday Low
if Low[0] < Low[1] then // Today Low < yesterday
if close CROSSES OVER close[1] then // Today price, crosses back above yesterday high closes > yesterday
Position = 1
else
Position = 0
endif
endif
endif
endif
endif
ENDIF
REM Short
if ADX[7] > 50 then // High ADX level, change comming
if open[1] < close[1] then// Greencandle[1]
if high[1] > myBollUp then // Yesterday high, outside BB
if open[0] < High[1] then // Open < yesterday high (to extend above)
if close CROSSES UNDER high[1] then // Today price Crosses under yesterday high
Position = -1
else
Position = 0
endif
endif
endif
Endif
ENDIF
If Position = 1 then
elsif Position = -1 then
Criteria = 1
else
Criteria = 0
endif
SCREENER [CRITERIA](Position AS "L.+1/S.-1")
I changed the code to be faster in its calculation, it works but I can only find stocks with Position=-1, so there must be something not good in your bullish conditions, but don’t know what sorry! 🙂
REM Turning Candle formation with Bollinger B on steroids (high/low pivots)
//General
myBollUp = Average[11](close)+1.5*std[11](close)
myBollDn = Average[11](close)-1.5*std[11](close)
//Long
if ADX[7] > 50 and open[1] > close[1] and low[1] < myBollDn and open[0] > Low[1] and Low[0] < Low[1] and close CROSSES OVER high[1] then // Today price, crosses back above yesterday high closes > yesterday
Position = 1
//short
elsif ADX[7] > 50 and open[1] < close[1] and high[1] > myBollUp and open[0] < High[1] and close CROSSES UNDER high[1] then // Today price Crosses under yesterday high
Position = -1
else
position = 0
endif
criteria = Position <> 0
SCREENER [CRITERIA](Position AS "L.+1/S.-1")
I found why, I changed the close CROSSES OVER in the bullish condition, here is my code with your initial condition for the cross (now found +1 Position):
REM Turning Candle formation with Bollinger B on steroids (high/low pivots)
//General
myBollUp = Average[11](close)+1.5*std[11](close)
myBollDn = Average[11](close)-1.5*std[11](close)
//Long
if ADX[7] > 50 and open[1] > close[1] and low[1] < myBollDn and open[0] > Low[1] and Low[0] < Low[1] and close CROSSES OVER close[1] then // Today price, crosses back above yesterday high closes > yesterday
Position = 1
//short
elsif ADX[7] > 50 and open[1] < close[1] and high[1] > myBollUp and open[0] < High[1] and close CROSSES UNDER high[1] then // Today price Crosses under yesterday high
Position = -1
else
position = 0
endif
criteria = Position <> 0
SCREENER [CRITERIA](Position AS "L.+1/S.-1")
PerParticipant
Average
This is a great improvement.
11 results found within all forex pairs provided by PRT. 2 findings on weekly charts. I am applying the same combination for Indicators, which now correlates with the findings in present by the screener.
I will add that by entering trade at crossing back over yesterday high/low, adding SL at today high/low this is a one bar (daily chart) trading strategy. With some guts, go trailing stop loss at entry on the next bar and cross the fingers, it may be the start of a lasting trend and success in caching the famous falling knife (and/or opposite). This will be studied by back testing and paper trading scripts. ps. ensure that momentums are right.
Appreciated and great thanks,
Per I