TA_1.14
Download scriptThis Trade Assistant is a multi-dimensional technical analysis tool designed to provide traders with a snapshot of market conditions across several timeframes simultaneously. Rather than focusing on a single chart, it organizes various technical indicators into a clean, easy-to-read dashboard.
Overview of Functionality
The script monitors six different timeframes (ranging from 1 minute to 4 hours) and tracks four specific types of market signals. It translates complex mathematical data into visual cues—specifically arrows and text labels—allowing you to see at a glance whether the current momentum is bullish (Buy), bearish (Sell), or neutral (Wait).
Core Indicators & Logic
The assistant uses four primary indicators to evaluate the market:
1. Stochastic Oscillator
- Purpose: Identifies overbought or oversold conditions and momentum shifts.
- Logic: It compares two different lines of the Stochastic oscillator. If the main line crosses above the signal line, it signals a potential "Buy." If it crosses below, it indicates a "Sell." If they are aligned in a neutral way, it prompts the user to "Wait."
2. Relative Strength Index (RSI)
- Purpose: Measures the speed and change of price movements to identify trend strength.
- Logic: The script compares current RSI values against specific thresholds. When the value exceeds the upper threshold, it signals a sell condition; when it falls below the lower threshold, it signals a buy condition.
3. Entry Commodity Channel Index (CCI)
- Purpose: Identifies new trends and potential entry points by measuring price deviation from an average.
- Logic: This indicator looks at whether the CCI is currently above or below zero and checks if the value is moving upward or downward relative to the previous bar. It provides specific "Buy" or "Sell" signals based on whether the momentum is reinforcing the current direction.
4. Trend Commodity Channel Index (CCI)
- Purpose: Designed specifically to identify the broader market trend.
- Logic: Similar to the Entry CCI, this uses different sensitivity settings to filter out "noise." It helps determine if the overall trend is leaning towards a price increase or decrease by analyzing the direction of the CCI relative to the zero line.
Visual Dashboard Layout
The script organizes this data into a structured grid:
- Timeframe Labels: Clearly marked columns for 1m, 5m, 15m, 30m, 1h, and 4h.
- Signal Rows: Dedicated rows for Stochastic, RSI, Entry CCI, and Trend CCI.
- Color Coding:
- Lime Green: Indicates a Buy signal.
- Red: Indicates a Sell signal.
- Khaki/Gold: Indicates a "Wait" state or a neutral market condition where no clear action is recommended.
By consolidating these diverse metrics into one window, the tool allows you to verify if multiple timeframes and different types of indicators are agreeing before making a trade decision.
//+------------------------------------------------------------------+
//| Trade Assistant |
//| TA_1.14.mq4 |
//| Copyright © 2008 Tom Balfe |
//| |
//| This indicator helps you trade by giving you two signals on |
//| multiple timeframes. It bases it's recommendations on RSI and |
//| stochastics. |
//| |
//| Version: 1.14 |
//| |
//| Changelog: |
//| |
//| 1.14 - added CCI, entry and trend |
//| 1.12 - fixed RSI code |
//| 1.11 - fixed spacing between objects |
//| 1.1 - added buy/sell text |
//| 1.0 - first version, got arrows working |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008 Tom Balfe"
#property link "redcarsarasota@yahoo.com"
#property indicator_separate_window
//--- spacing
int scaleX=120,scaleY=20,offsetX=200,offsetY=4,fontSize=8;
//--- arrays for various things
int TF[] = {1,5,15,30,60,240};
int eCCI[] = {14,14,6,6,6,6};
int tCCI[] = {50,34,14,14,14,14};
string periodStr[] = {"1 MIN:","5 MIN:","15 MIN:","30 MIN:","1 HR:","4 HR:"};
string signalNameStr[] = {"STOCH","RSI","EntryCCI","TrendCCI"};
//+------------------------------------------------------------------+
//| USER ADJUSTABLE STUFF |
//+------------------------------------------------------------------+
extern string Stochastic_Settings = "=== Stochastic Settings ===";
extern int PercentK = 8;
extern int PercentD = 3;
extern int Slowing = 3;
extern string RSI_Settings = "=== RSI Settings ===";
extern int RSIP1 = 14;
extern int RSIP2 = 70;
extern string My_Symbols = "=== Wingdings Symbols ===";
extern int sBuy = 233;
extern int sSell = 234;
extern int sWait = 54;
extern int sCCIAgainstBuy = 238;
extern int sCCIAgainstSell = 236;
//+------------------------------------------------------------------+
//| Initialization function |
//+------------------------------------------------------------------+
int init()
{
//-- indicator short name
IndicatorShortName("Trade Assistant 1.14 ");
return(0);
}
//+------------------------------------------------------------------+
//| Deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//-- need to delete objects should user remove indicator
ObjectsDeleteAll(0,OBJ_LABEL);
//-- delete timeframe text labels
for(int x=0;x<6;x++)
for (int y=0;y<4;y++)
{ ObjectDelete("tPs"+x+y); }
//-- delete indicator text labels
for(y=0;y<4;y++)
{ ObjectDelete("tInd"+y); }
//-- delete indicator arrows and text
for (x=0;x<6;x++)
for (y=0;y<4;y++)
{ ObjectDelete("dI"+x+y); }
for (x=0;x<6;x++)
for (y=0;y<4;y++)
{ ObjectDelete("tI"+x+y); }
return(0);
}
//+------------------------------------------------------------------+
//| MAIN LOOP |
//+------------------------------------------------------------------+
int start()
{
//--- create timeframe text labels
for (int x=0;x<6;x++)
for (int y=0;y<4;y++)
{
ObjectCreate("tPs"+x+y,OBJ_LABEL,WindowFind("Trade Assistant 1.14 "),0,0);
ObjectSetText("tPs"+x+y,periodStr[x],fontSize,"Arial Bold",LightSteelBlue);
ObjectSet("tPs"+x+y,OBJPROP_CORNER,0);
ObjectSet("tPs"+x+y,OBJPROP_XDISTANCE,x*scaleX+offsetX);
ObjectSet("tPs"+x+y,OBJPROP_YDISTANCE,y*scaleY+offsetY);
}
//--- create indicator text labels
for (y=0;y<4;y++)
{
ObjectCreate("tInd"+y,OBJ_LABEL,WindowFind("Trade Assistant 1.14 "),0,0);
ObjectSetText("tInd"+y,signalNameStr[y],fontSize,"Arial Bold",PaleGoldenrod);
ObjectSet("tInd"+y,OBJPROP_CORNER,0);
ObjectSet("tInd"+y,OBJPROP_XDISTANCE,offsetX-55);
ObjectSet("tInd"+y,OBJPROP_YDISTANCE,y*scaleY+offsetY);
}
//--- create blanks for arrows
for (x=0;x<6;x++)
for (y=0;y<4;y++)
{
ObjectCreate("dI"+x+y,OBJ_LABEL,WindowFind("Trade Assistant 1.14 "),0,0);
ObjectSetText("dI"+x+y," ",10,"Wingdings",Goldenrod);
ObjectSet("dI"+x+y,OBJPROP_CORNER,0);
ObjectSet("dI"+x+y,OBJPROP_XDISTANCE,x*scaleX+(offsetX+80)); // scaleX == 120, offsetX == 200
ObjectSet("dI"+x+y,OBJPROP_YDISTANCE,y*scaleY+offsetY);
}
//--- create blanks for text
for (x=0;x<6;x++)
for (y=0;y<4;y++)
{
ObjectCreate("tI"+x+y,OBJ_LABEL,WindowFind("Trade Assistant 1.14 "),0,0);
ObjectSetText("tI"+x+y," ",9,"Arial Bold",Goldenrod);
ObjectSet("tI"+x+y,OBJPROP_CORNER,0);
ObjectSet("tI"+x+y,OBJPROP_XDISTANCE,x*scaleX+(offsetX+45)); // scaleX == 120, offsetX == 200
ObjectSet("tI"+x+y,OBJPROP_YDISTANCE,y*scaleY+offsetY);
}
//--- stochastics arrows
for(x=0;x<6;x++)
{
if((iStochastic(NULL,TF[x],PercentK,PercentD,Slowing,MODE_SMA,0,MODE_MAIN,0)) >
(iStochastic(NULL,TF[x],PercentK,PercentD,Slowing,MODE_SMA,0,MODE_SIGNAL,0)))
ObjectSetText("dI"+x+"0",CharToStr(sBuy),fontSize,"Wingdings",Lime);
else if
((iStochastic(NULL,TF[x],PercentK,PercentD,Slowing,MODE_SMA,0,MODE_SIGNAL,0)) >
(iStochastic(NULL,TF[x],PercentK,PercentD,Slowing,MODE_SMA,0,MODE_MAIN,0)))
ObjectSetText("dI"+x+"0",CharToStr(sSell),fontSize,"Wingdings",Red);
else
ObjectSetText("dI"+x+"0",CharToStr(sWait),10,"Wingdings",Khaki);
}
//--- stochastics text
for(x=0;x<6;x++)
{
if((iStochastic(NULL,TF[x],PercentK,PercentD,Slowing,MODE_SMA,0,MODE_MAIN,0)) >
(iStochastic(NULL,TF[x],PercentK,PercentD,Slowing,MODE_SMA,0,MODE_SIGNAL,0)))
ObjectSetText("tI"+x+"0"," BUY",9,"Arial Bold",Lime);
else if
((iStochastic(NULL,TF[x],PercentK,PercentD,Slowing,MODE_SMA,0,MODE_SIGNAL,0)) >
(iStochastic(NULL,TF[x],PercentK,PercentD,Slowing,MODE_SMA,0,MODE_MAIN,0)))
ObjectSetText("tI"+x+"0","SELL",9,"Arial Bold",Red);
else
ObjectSetText("tI"+x+"0","WAIT",9,"Arial Bold",Khaki);
}
//--- RSI arrows
for(x=0;x<6;x++)
{
if ((iRSI(NULL,TF[x],RSIP1,PRICE_TYPICAL,0)) > (iRSI(NULL,TF[x],RSIP2,PRICE_TYPICAL,0)))
ObjectSetText("dI"+x+"1",CharToStr(sBuy),fontSize,"Wingdings",Lime);
else if
((iRSI(NULL,TF[x],RSIP2,PRICE_TYPICAL,0)) > (iRSI(NULL,TF[x],RSIP1,PRICE_TYPICAL,0)))
ObjectSetText("dI"+x+"1",CharToStr(sSell),fontSize,"Wingdings",Red);
else
ObjectSetText("dI"+x+"1",CharToStr(sWait),fontSize,"Wingdings",Khaki);
}
//--- RSI text
for(x=0;x<6;x++)
{
if ((iRSI(NULL,TF[x],RSIP1,PRICE_TYPICAL,0)) > (iRSI(NULL,TF[x],RSIP2,PRICE_TYPICAL,0)))
ObjectSetText("tI"+x+"1"," BUY",9,"Arial Bold",Lime);
else if
((iRSI(NULL,TF[x],RSIP2,PRICE_TYPICAL,0)) > (iRSI(NULL,TF[x],RSIP1,PRICE_TYPICAL,0)))
ObjectSetText("tI"+x+"1","SELL",9,"Arial Bold",Red);
else
ObjectSetText("tI"+x+"1","WAIT",9,"Arial Bold",Khaki);
}
//--- EntryCCI arrows
for(x=0;x<6;x++)
{
if ((iCCI(NULL,TF[x],eCCI[x],PRICE_TYPICAL,0))>0) // if entry cci above zero
{
if ((iCCI(NULL,TF[x],eCCI[x],PRICE_TYPICAL,0))>(iCCI(NULL,TF[x],eCCI[x],PRICE_TYPICAL,1)))
ObjectSetText("dI"+x+"2",CharToStr(sBuy),fontSize,"Wingdings",Lime);
else ObjectSetText("dI"+x+"2",CharToStr(sCCIAgainstBuy),fontSize,"Wingdings",Red);
}
else if
((iCCI(NULL,TF[x],eCCI[x],PRICE_TYPICAL,0)) <0) // if entry cci below zero
{
if ((iCCI(NULL,TF[x],eCCI[x],PRICE_TYPICAL,0)) < (iCCI(NULL,TF[x],eCCI[x],PRICE_TYPICAL,1)))
ObjectSetText("dI"+x+"2",CharToStr(sSell),fontSize,"Wingdings",Red);
else ObjectSetText("dI"+x+"2",CharToStr(sCCIAgainstSell),fontSize,"Wingdings",Lime);
}
else
ObjectSetText("dI"+x+"2",CharToStr(sWait),10,"Wingdings",Khaki);
}
//--- EntryCCI text
for(x=0;x<6;x++)
{
if ((iCCI(NULL,TF[x],eCCI[x],PRICE_TYPICAL,0)) >0) // if entry cci above zero
{
if ((iCCI(NULL,TF[x],eCCI[x],PRICE_TYPICAL,0))>(iCCI(NULL,TF[x],eCCI[x],PRICE_TYPICAL,1)))
ObjectSetText("tI"+x+"2"," BUY",9,"Arial Bold",Lime);
else ObjectSetText("tI"+x+"2","SELL",9,"Arial Bold",Red);
}
else if
((iCCI(NULL,TF[x],eCCI[x],PRICE_TYPICAL,0)) <0) // if entry cci below zero
{
if ((iCCI(NULL,TF[x],eCCI[x],PRICE_TYPICAL,0))<(iCCI(NULL,TF[x],eCCI[x],PRICE_TYPICAL,1)))
ObjectSetText("tI"+x+"2","SELL",9,"Arial Bold",Red);
else ObjectSetText("tI"+x+"2"," BUY",9,"Arial Bold",Lime);
}
else
ObjectSetText("tI"+x+"2","WAIT",9,"Arial Bold",Khaki);
}
//--- TrendCCI arrows
for(x=0;x<6;x++)
{
if ((iCCI(NULL,TF[x],tCCI[x],PRICE_TYPICAL,0))>0) // if entry cci above zero
{
if ((iCCI(NULL,TF[x],tCCI[x],PRICE_TYPICAL,0))>(iCCI(NULL,TF[x],tCCI[x],PRICE_TYPICAL,1)))
ObjectSetText("dI"+x+"3",CharToStr(sBuy),fontSize,"Wingdings",Lime);
else ObjectSetText("dI"+x+"3",CharToStr(sCCIAgainstBuy),fontSize,"Wingdings",Red);
}
else if
((iCCI(NULL,TF[x],tCCI[x],PRICE_TYPICAL,0)) <0) // if entry cci below zero
{
if ((iCCI(NULL,TF[x],tCCI[x],PRICE_TYPICAL,0)) < (iCCI(NULL,TF[x],tCCI[x],PRICE_TYPICAL,1)))
ObjectSetText("dI"+x+"3",CharToStr(sSell),fontSize,"Wingdings",Red);
else ObjectSetText("dI"+x+"3",CharToStr(sCCIAgainstSell),fontSize,"Wingdings",Lime);
}
else
ObjectSetText("dI"+x+"3",CharToStr(sWait),10,"Wingdings",Khaki);
}
//--- TrendCCI text
for(x=0;x<6;x++)
{
if ((iCCI(NULL,TF[x],tCCI[x],PRICE_TYPICAL,0)) >0) // if entry cci above zero
{
if ((iCCI(NULL,TF[x],tCCI[x],PRICE_TYPICAL,0))>(iCCI(NULL,TF[x],tCCI[x],PRICE_TYPICAL,1)))
ObjectSetText("tI"+x+"3"," BUY",9,"Arial Bold",Lime);
else ObjectSetText("tI"+x+"3","SELL",9,"Arial Bold",Red);
}
else if
((iCCI(NULL,TF[x],tCCI[x],PRICE_TYPICAL,0)) <0) // if entry cci below zero
{
if ((iCCI(NULL,TF[x],tCCI[x],PRICE_TYPICAL,0))<(iCCI(NULL,TF[x],tCCI[x],PRICE_TYPICAL,1)))
ObjectSetText("tI"+x+"3","SELL",9,"Arial Bold",Red);
else ObjectSetText("tI"+x+"3"," BUY",9,"Arial Bold",Lime);
}
else
ObjectSetText("tI"+x+"3","WAIT",9,"Arial Bold",Khaki);
}
return(0);
}
//+------------------------------------------------------------------+
//| END MAIN LOOP |
//+------------------------------------------------------------------+
Comments