vignesh222

Triple Moving Average Crossover

Below is the Pine Script code for TradingView that creates an indicator with three user-defined moving averages (with default periods of 10, 50, and 100) and labels for buy and sell signals at key crossovers. Additionally, it creates a label if the price increases by 100 points from the buy entry or decreases by 100 points from the sell entry, with the label saying "+100".

Explanation:
Indicator Definition: indicator("Triple Moving Average Crossover", overlay=true) defines the script as an indicator that overlays on the chart.
User Inputs: input.int functions allow users to define the periods for the short, middle, and long moving averages with defaults of 10, 50, and 100, respectively.
Moving Averages Calculation: The ta.sma function calculates the simple moving averages for the specified periods.
Plotting Moving Averages: plot functions plot the short, middle, and long moving averages on the chart with blue, orange, and red colors.
Crossover Detection: ta.crossover and ta.crossunder functions detect when the short moving average crosses above or below the middle moving average and when the middle moving average crosses above or below the long moving average.
Entry Price Tracking: Variables buyEntryPrice and sellEntryPrice store the buy and sell entry prices. These prices are updated whenever a bullish or bearish crossover occurs.
100 Points Move Detection: buyTargetReached checks if the current price has increased by 100 points from the buy entry price. sellTargetReached checks if the current price has decreased by 100 points from the sell entry price.
Plotting Labels: plotshape functions plot the buy and sell labels at the crossovers and the +100 labels when the target moves are reached. The labels are displayed in white and green colors.
オープンソーススクリプト

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。

免責事項

これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。

チャートでこのスクリプトを利用したいですか?