OPEN-SOURCE SCRIPT

HMA 4H and 15M overlay

Notes:
HMA Calculation: We calculate three HMAs for the 15-minute timeframe (ma1, ma2, ma3) based on the settings from your original script, but only ma3 is plotted to keep it consistent with your initial setup.
4-hour HMA: An additional HMA is calculated for the 4-hour timeframe (hma4h) using the hma3 period since it was the longest in your original setup, which might be suitable for a 4-hour chart comparison.
Plotting: Both the 15-minute ma3 and 4-hour hma4h HMAs are plotted with distinct colors for easy visual differentiation.
Timeframe Security: request.security() is used to fetch data from different timeframes. Remember, using request.security() with historical data can sometimes lead to misalignments or delayed data, especially during live trading.

This script will overlay the 15-minute HMA (using the ma3 from your settings) with a new 4-hour HMA on any chart timeframe you apply it to. Remember, if you're looking at a chart timeframe that's not 15 minutes or 4 hours, the HMAs might appear less smooth or aligned due to how Pine Script handles different timeframes.

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.