Hi,
I’m trying to run a scan inspired by the Ichimoku Tenkan-Kijun Cross (screener) written by Doctrading.
But instead of matching “now” I would like the results to match a variable day in the past, (for example 7 days ago)…
What I’m basically trying to achieve is to have :
• Tenkan over the Kijun
• Tenkan & Kijun > Kumo
• Close > Kumo
• Chikou > Kumo
And this should match the 7th bar ago (not the current one..)
I was wondering, is that actually possible to run a scan back in time ?
Thank you for your help…
So far I came up with this.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
// Original code // Ichimoku Tenkan-Kijun Cross (screener) // https://www.prorealcode.com/prorealtime-market-screeners/ichimoku-tenkan-kijun-cross-screener/ INDICATEUR = 0 period1 = 9 period2 = 26 period3 = 52 howManyDaysAgo = 7 period1 = period1 + howManyDaysAgo period2 = period2 + howManyDaysAgo period3 = period3 + howManyDaysAgo Tenkansen = (highest[period1](Dclose(howManyDaysAgo)) + lowest[period1](Dclose(howManyDaysAgo))) / 2 Kijunsen = (highest[period2](Dclose(howManyDaysAgo)) + lowest[period2](Dclose(howManyDaysAgo))) / 2 SSpanA = (tenkansen[period2]+kijunsen[period2])/2 SSpanB = (highest[period3](high[period2])+lowest[period3](low[period2]))/2 Chikou = close[period2] // ACHAT C1 = close > SSpanA and close > SSpanB C2 = Tenkansen > Kijunsen C3 = Tenkansen > SSpanA and Tenkansen > SSpanB C4 = Kijunsen > SSpanA and Kijunsen > SSpanB C5 = Chikou > SSpanA[period2] and Chikou > SSpanB[period2] IF C1 and C2 and C3 and C4 and C5 THEN INDICATEUR = 1 ENDIF screener[INDICATEUR] |