pAulseperformance

MA Cross - ***Programmers*** Please help with alertcondition()

Hello Traders and coders,

Here is a fundamental version of a moving average cross trading strategy that works on 1H and 4H timeframes.

It's very simple and would be well paired with proper technical analysis and risk management.

I am looking to use this to alert me of potential setups. I could not get the alertcondition function to work properly. If anyone can help me with that please comment or message me.
Skrip sumber terbuka

Dalam semangat TradingView yang sebenar, penulis skrip ini telah menerbitkannya dengan menggunakan sumber terbuka supaya pedagang-pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda dapat menggunakannya secara percuma tetapi penggunaan semula kod ini dalam penerbitan adalah dikawalselia oleh Peraturan Rumah. Anda boleh menyukai skrip ini untuk menggunakannya pada carta.

Ingin menggunakan skrip ini pada carta?
//@version=2
strategy(shorttitle = "Gamma pips EMA Cross", title="MA Cross", overlay=true)
s100sma = sma(close, 100)
s200sma = sma(close, 200)
s26ema = ema(close,26)
s12ema = ema(close,12)

plot(s100sma, color = green, linewidth = 5)
plot(s200sma, color = blue, linewidth = 5)
plot(s26ema, color = yellow, linewidth = 3)
plot(s12ema, color = red, linewidth = 3)
EMACross = plot(cross(s26ema, s12ema) ? s26ema : na, style = cross, linewidth = 5, color = red)
SMACross = plot(cross(s100sma, s200sma) ? s200sma : na, style = cross, linewidth = 5, color = white)
Alert = cross(s26ema, s12ema)
alertcondition(Alert, title="EMA Crossing")

//============ signal Generator ==================================//
EMACrossover = crossover(s26ema, s12ema) //if yellow cross and is above red ->SELL
EMACrossunder = crossunder(s26ema, s12ema) //if yellow cross and is below red ->BUY
SMACrossover = crossover(s100sma, s200sma) //green crosses above blue ->Buy
SMACrossunder = crossunder (s100sma, s200sma) //green crosses below below ->Sell
price = close
BuyCondition = (EMACrossunder) and (price >= s100sma)
SellCondition = (EMACrossover) and (price <= s100sma)

///---------Buy Signal-------------///
if (BuyCondition)
    strategy.order("BUY ema crossunder", strategy.long)

 
///Short signal------//
if(SellCondition)
    strategy.order("SELL ema crossover", strategy.short)
   

Komen

Alertconditon dont work in strategy only in study ;)
+4 Balas
If you have yet to figure this out, I would be happy to help
Balas
I'm sure you've figured this out after 5 months, but for anyone having the same problem I'm pretty sure it's because alertcondition doesn't work if the script is a strategy. Only if it's a study (the relevant part is mentioned on line 2) - I'm not fully confident this is the case, but there's so like Pine script info available online I figured I'd try and contribute.
Balas
scarf scarf
*little
Balas
@scarf, Replying to your edit - thanks for the information. Any one else still trying to figure this out, this is the case. You cannot have it as a strategy, it must be a study.
+4 Balas
Hello,

Were you able to get a solution to this? I have a project I'd like to implement (pay for someone to develop) and it depends on being able to alert by sms. Just wondering if you solved it? - thanks! Also, how do I find programmers on here who are available for hire?
Balas
@niallc, Hi Niall I used Codementors to find a programmer to help me out with the pine scripts. Cost me only 15$ for 15 minutes on a 1 to 1 video chat. https://www.codementor.io/r/T3J3LG26F2.
Did you find another solution yourself.
Greetings from Cork, love the flag btw.
Balas
niallc IrishInvestor
@IrishInvestor, Fair play to you - thanks! I never followed up on that and took a break from trading actively so no...never did get a solution. But I'll be bookmarking that site for sure. I live in Atlanta now, but I'll be back in Dublin for me father's birthday in a week or so...Cheers and Be Well. Niall.
Balas
Laman Utama Penyaring Saham Penyaring Forex Penyaring Kripto Kalendar Ekonomi Mengenai Ciri-ciri Carta Harga Rujuk rakan Peraturan Dalaman Pusat Bantuan Laman web dan Penyelesaian Broker Widget Penyelesaian Pencartaan Perpustakaan Pencartaan yang Ringan Blog & Berita Twitter
Profil Tetapan Profil Akaun dan Pengebilan Kawan-kawan yang dirujuk Coin Tiket Sokongan Saya Pusat Bantuan Mesej Peribadi Sembang Daftar Keluar