P2-V2 also known as Penner2.0 began with a TEMA and MA cross on Heiken Ashi, a strategy brought to us by a group of crypto traders. Since then we've added a few more indicators and played around with the rules.
This is an early release as I have yet to go through the full automation aspect, however, I know some of you would like to see where it's at.
If you'd like to learn how to automate a full strategy using the Chrome Extension, go to the linked idea for a eurusd setup.
//Moving Average smaLength = input(7, minval=1) sma = sma(c, smaLength)
//RSI src = c rsiLength = input(4, minval=1, title="Length")
up = rma(max(change(src), 0), rsiLength) down = rma(-min(change(src), 0), rsiLength) rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
rsin= input(9) sn = 100 - rsin ln = 0 + rsin
//Strategy gc = c > o ? 1 : 0 rc = c < o ? 1 : 0 long = crossover(tema[2], sma[2]) and gc[1] == 1 and gc == 1 and rsi > sn short = crossunder(tema[2], sma[2]) and rc[1] == 1 and rc == 1 and rsi < ln
The above alert script did not copy/paste properly and is getting an error, to avoid clutter, just replace the bottom section @ //Strategy
//Strategy gc = c > o ? 1 : 0 rc = c < o ? 1 : 0 long = crossover(tema[2], sma[2]) and gc[1] == 1 and gc == 1 and rsi > sn short = crossunder(tema[2], sma[2]) and rc[1] == 1 and rc == 1 and rsi < ln
//Strategy gc = c > o ? 1 : 0 rc = c < o ? 1 : 0 long = crossover(tema[2], sma[2]) and gc[1] == 1 and gc == 1 and rsi > sn short = crossunder(tema[2], sma[2]) and rc[1] == 1 and rc == 1 and rsi < ln
To avoid repainting, this code needs to be adjusted. Results actually improve once the issue is corrected. On line 11 - 14 you'll see this... o = security(data, period, open) h = security(data, period, high) l = security(data, period, low) c = security(data, period, close)
we need to actually use the previous candle to avoid repainting, so just add a 1 candle look back. square brackets 1 after the words "open, high, low, close"
TV does not let me paste the brackets, but you can see on line 12-16 of this strategy here what is needed.
Hope this makes sense. Good luck.
הערות שחרור
Updated to Pinescript version 3 and added the new standard components.
ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.