Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mt4
//+------------------------------------------------------------------+
//| 1_Min_Micro_Trading.mq4 |
//| StarLimit Software Corps., |
//| starlimit04@yahoo.com |
//+------------------------------------------------------------------+
#property copyright "StarLimit Software Corps.,"
#property link "starlimit04@yahoo.com"
#property indicator_chart_window
extern int scaleX=20,
scaleY=15,
offSetX=25, // 35
offSetY=20, //20
fontSize=15,
corner=4,
symbolCodeBuy=217,
symbolCodeSell=218,
symbolCodeNoSignal=216,
allBuy=200,
allSell=202;
extern color signalBuyColor=Blue, //Strong Up
signalSellColor=Lime, //Strong Down
noSignalColor=Red,
allSellColor=OrangeRed,
allBuyColor=Blue,
textColor=Red;
int rsibuy[8],rsisell[8],sarbuy[8],sarsell[8],mabuy[8],masell[8],macdbuy[8],macdsell[8],adxbuy[8],adxsell[8],allsell[1],allbuy[1];
int period[]={ 5,15,30,60,240,1440};
string periodString[]={ "M5","M15","M30","H1","H4","D1"};
string signalName[]={"RSI","SAR","MA","MACD","ADX","ALL"};
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
for(int x=0;x<6;x++)
for(int y=0; y<6;y++)
{
ObjectCreate("signal"+x+y,OBJ_LABEL,0,0,0,0,0);
ObjectSet("signal"+x+y,OBJPROP_CORNER,corner);
ObjectSet("signal"+x+y,OBJPROP_XDISTANCE,x*scaleX + offSetX);
ObjectSet("signal"+x+y,OBJPROP_YDISTANCE,y*scaleY+offSetY);
ObjectSetText("signal"+x+y,CharToStr(symbolCodeNoSignal),fontSize,"Wingdings",noSignalColor);
}
for( x=0;x<6;x++)
{
ObjectCreate("textPeriod"+x,OBJ_LABEL,0,0,0,0,0);
ObjectSet("textPeriod"+x,OBJPROP_CORNER,corner);
ObjectSet("textPeriod"+x,OBJPROP_XDISTANCE,x*scaleX+offSetX);
ObjectSet("textPeriod"+x,OBJPROP_YDISTANCE,offSetY-10);
ObjectSetText("textPeriod"+x,periodString[x],8,"Tahoma",textColor);
}
for( y=0;y<6;y++)
{
ObjectCreate("textSignal"+y,OBJ_LABEL,0,0,0,0,0);
ObjectSet("textSignal"+y,OBJPROP_CORNER,corner);
ObjectSet("textSignal"+y,OBJPROP_YDISTANCE,y*scaleY+offSetY+8);
ObjectSet("textSignal"+y,OBJPROP_XDISTANCE,offSetX-25);
ObjectSetText("textSignal"+y,signalName[y],8,"Tahoma",textColor);
}
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
Comment(" " );
// DELETE ALL OBJECTS CREATED BY THIS INDICATOR.
for(int x=0;x<6;x++)
for(int y=0; y<6;y++)
{
ObjectDelete("signal"+x+y);
}
for( x=0;x<6;x++)
{
ObjectDelete("textPeriod");
}
for( y=0;y<6;y++)
{
ObjectDelete("textSignal");
}
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
for(int x=0;x<6;x++)
for(int y=0; y<5;y++)
{
ObjectCreate("signal"+x+y,OBJ_LABEL,0,0,0,0,0);
ObjectSet("signal"+x+y,OBJPROP_CORNER,corner);
ObjectSet("signal"+x+y,OBJPROP_XDISTANCE,x*scaleX + offSetX);
ObjectSet("signal"+x+y,OBJPROP_YDISTANCE,y*scaleY+offSetY);
ObjectSetText("signal"+x+y,CharToStr(symbolCodeNoSignal),fontSize,"Wingdings",noSignalColor);
}
for( x=0;x<6;x++)
{
ObjectCreate("textPeriod"+x,OBJ_LABEL,0,0,0,0,0);
ObjectSet("textPeriod"+x,OBJPROP_CORNER,corner);
ObjectSet("textPeriod"+x,OBJPROP_XDISTANCE,x*scaleX+offSetX);
ObjectSet("textPeriod"+x,OBJPROP_YDISTANCE,offSetY-10);
ObjectSetText("textPeriod"+x,periodString[x],8,"Tahoma",textColor);
}
for( y=0;y<6;y++)
{
ObjectCreate("textSignal"+y,OBJ_LABEL,0,0,0,0,0);
ObjectSet("textSignal"+y,OBJPROP_CORNER,corner);
ObjectSet("textSignal"+y,OBJPROP_YDISTANCE,y*scaleY+offSetY+8);
ObjectSet("textSignal"+y,OBJPROP_XDISTANCE,offSetX-25);
ObjectSetText("textSignal"+y,signalName[y],8,"Tahoma",textColor);
}
for( int a=0;a<6;a++)
{
if(iRSI(NULL,period[a],14,PRICE_CLOSE,0) >50) //Buy
{
ObjectSetText("signal"+a+"0",CharToStr(symbolCodeBuy),fontSize,"Wingdings",signalBuyColor);
rsibuy[a]=1;
rsisell[a]=0;
}
else if(iRSI(NULL,period[a],14,PRICE_CLOSE,0) <50) //Sell
{
ObjectSetText("signal"+a+"0",CharToStr(symbolCodeSell),fontSize,"Wingdings",signalSellColor);
rsisell[a]=1;
rsibuy[a]=0;
}
else
{
ObjectSetText("signal"+a+"0",CharToStr(symbolCodeNoSignal),fontSize,"Wingdings",noSignalColor);
rsisell[a]=0;
rsibuy[a]=0;
}
}
for( a=0;a<6;a++)
{
if(iSAR(NULL,period[a],0.02,0.2,0)< Ask) //buy
{
ObjectSetText("signal"+a+"1",CharToStr(symbolCodeBuy),fontSize,"Wingdings",signalBuyColor);
sarbuy[a]=1;
sarsell[a]=0;
}
else
{
ObjectSetText("signal"+a+"1",CharToStr(symbolCodeSell),fontSize,"Wingdings",signalSellColor);
sarsell[a]=1;
sarbuy[a]=0;
}
}
for( a=0;a<6;a++)
{
if(iMA(NULL,period[a],5,0,MODE_EMA,PRICE_CLOSE,0) > iMA(NULL,period[a],20,0,MODE_SMA,PRICE_CLOSE,0)
&& iMA(NULL,period[a],5,0,MODE_EMA,PRICE_CLOSE,0) > iMA(NULL,period[a],10,0,MODE_EMA,PRICE_CLOSE,0))
{
ObjectSetText("signal"+a+"2",CharToStr(symbolCodeBuy),fontSize,"Wingdings",signalBuyColor);
mabuy[a]=1;
masell[a]=0;
}
else if(iMA(NULL,period[a],5,0,MODE_EMA,PRICE_CLOSE,0) < iMA(NULL,period[a],20,0,MODE_SMA,PRICE_CLOSE,0)
&& iMA(NULL,period[a],5,0,MODE_EMA,PRICE_CLOSE,0) < iMA(NULL,period[a],10,0,MODE_EMA,PRICE_CLOSE,0))
{
ObjectSetText("signal"+a+"2",CharToStr(symbolCodeSell),fontSize,"Wingdings",signalSellColor);
masell[a]=1;
mabuy[a]=0;
}
else
{
ObjectSetText("signal"+a+"2",CharToStr(symbolCodeNoSignal),fontSize,"Wingdings",noSignalColor);
masell[a]=0;
mabuy[a]=0;
}
}
for( a=0;a<6;a++)
{
double main=iMACD(NULL,period[a],12,26,9,PRICE_CLOSE,MODE_MAIN,1);
double signal=iMACD(NULL,period[a],12,26,9,PRICE_CLOSE,MODE_SIGNAL,1);
if(main > signal && signal >0) // for M5 and M15
{
ObjectSetText("signal"+a+"3",CharToStr(symbolCodeBuy),fontSize,"Wingdings",signalBuyColor);
macdbuy[a]=1;
macdsell[a]=0;
}
else if(main > signal && main >0) // for M30 and H1
{
ObjectSetText("signal"+a+"3",CharToStr(symbolCodeBuy),fontSize,"Wingdings",signalBuyColor);
macdbuy[a]=2;
macdsell[a]=0;
}
else if(main > signal && main <0) // for H4 and D1
{
ObjectSetText("signal"+a+"3",CharToStr(symbolCodeBuy),fontSize,"Wingdings",signalBuyColor);
macdbuy[a]=3;
macdsell[a]=0;
}
else if(main <signal && signal < 0) // for M5 and M15
{
ObjectSetText("signal"+a+"3",CharToStr(symbolCodeSell),fontSize,"Wingdings",signalSellColor);
macdbuy[a]=0;
macdsell[a]=1;
}
else if(main <signal && main < 0) // for M30 and H1
{
ObjectSetText("signal"+a+"3",CharToStr(symbolCodeSell),fontSize,"Wingdings",signalSellColor);
macdbuy[a]=0;
macdsell[a]=2;
}
else if(main <signal && main > 0) // for H4 and D1
{
ObjectSetText("signal"+a+"3",CharToStr(symbolCodeSell),fontSize,"Wingdings",signalSellColor);
macdbuy[a]=0;
macdsell[a]=3;
}
else
{
ObjectSetText("signal"+a+"3",CharToStr(symbolCodeNoSignal),fontSize,"Wingdings",noSignalColor);
macdbuy[a]=0;
macdsell[a]=0;
}
}
for( a=0;a<6;a++)
{
double adx= iADX(NULL,period[a],14,PRICE_CLOSE,0,0);
double d_p= iADX(NULL,period[a],14,PRICE_CLOSE,1,0);
double d_n= iADX(NULL,period[a],14,PRICE_CLOSE,2,0);
if( ( d_p > 20 && adx < 20 && d_n < 20 && adx > d_n)
||( d_p > 25 && adx < 25 && d_n < 20 && adx > d_n)
||( d_p > 25 && d_n < 20 && adx < 20 && d_n > adx)
||( d_p > 25 && adx > 25 && d_n < 20 && d_p > adx)
||( adx > 25 && d_p > 25 && d_n < 15 && adx > d_p)
||( adx > 25 && d_p < 25 && d_n < 20 && d_p > d_n)
||( adx > 20 && d_p < 20 && d_n < 20 && d_p > d_n) )
{
ObjectSetText("signal"+a+"4",CharToStr(symbolCodeBuy),fontSize,"Wingdings",signalBuyColor);
adxbuy[a]=1;
adxsell[a]=0;
}
else if( ( d_n > 20 && adx < 20 && d_p < 20 && adx > d_p)
||( d_n > 25 && adx < 25 && d_p < 20 && adx > d_p)
||( d_n > 25 && d_p < 20 && adx < 20 && d_p > adx)
||( d_n > 25 && adx > 25 && d_p < 20 && d_n > adx)
||( adx > 25 && d_n > 25 && d_p < 15 && adx > d_n)
||( adx > 25 && d_n < 25 && d_p < 20 && d_n > d_p)
||( adx > 20 && d_n < 20 && d_p < 20 && d_n > d_p) )
{
ObjectSetText("signal"+a+"4",CharToStr(symbolCodeSell),fontSize,"Wingdings",signalSellColor);
adxbuy[a]=0;
adxsell[a]=1;
}
else
{
ObjectSetText("signal"+a+"4",CharToStr(symbolCodeNoSignal),fontSize,"Wingdings",noSignalColor);
adxbuy[a]=0;
adxsell[a]=0;
}
}
//....................ALL SIGNALS IN ONE .......................
for( a=0;a<6;a++)
{
if(a==0)
{
if(rsibuy[0]==1 && sarbuy[0]==1 && mabuy[0]==1 && macdbuy[0]==1 && adxbuy[0]==1)
{
ObjectSetText("signal"+a+"5",CharToStr(allBuy),fontSize+5,"Wingdings",allBuyColor);
allbuy[0]=1;
allsell[0]=0;
}
else if(rsisell[0]==1 && sarsell[0]==1 && masell[0]==1 && macdsell[0]==1 && adxsell[0]==1)
{
ObjectSetText("signal"+a+"5",CharToStr(allSell),fontSize+5,"Wingdings",allSellColor);
allbuy[0]=0;
allsell[0]=1;
}
else
{
ObjectSetText("signal"+a+"5",CharToStr(symbolCodeNoSignal),fontSize,"Wingdings",noSignalColor);
allbuy[0]=0;
allsell[0]=0;
}
}
if(a==1)
{
if(rsibuy[1]==1 && sarbuy[1]==1 && mabuy[1]==1 && macdbuy[1]==1 && adxbuy[1]==1)
{
ObjectSetText("signal"+a+"5",CharToStr(allBuy),fontSize+5,"Wingdings",allBuyColor);
allbuy[1]=1;
allsell[1]=0;
}
else if(rsisell[1]==1 && sarsell[1]==1 && masell[1]==1 && macdsell[1]==1 && adxsell[1]==1)
{
ObjectSetText("signal"+a+"5",CharToStr(allSell),fontSize+5,"Wingdings",allSellColor);
allbuy[1]=0;
allsell[1]=1;
}
else
{
ObjectSetText("signal"+a+"5",CharToStr(symbolCodeNoSignal),fontSize,"Wingdings",noSignalColor);
allbuy[1]=0;
allsell[1]=0;
}
}
if(a==2)
{
if(rsibuy[2]==1 && sarbuy[2]==1 && mabuy[2]==1 && (macdbuy[2]==1 || macdbuy[2]== 2) && adxbuy[2]==1)
{
ObjectSetText("signal"+a+"5",CharToStr(allBuy),fontSize+5,"Wingdings",allBuyColor);
allbuy[2]=1;
allsell[2]=0;
}
else if(rsisell[2]==1 && sarsell[2]==1 && masell[2]==1 && (macdsell[2]==1 || macdsell[2]==2) && adxsell[2]==1)
{
ObjectSetText("signal"+a+"5",CharToStr(allSell),fontSize+5,"Wingdings",allSellColor);
allbuy[2]=0;
allsell[2]=1;
}
else
{
ObjectSetText("signal"+a+"5",CharToStr(symbolCodeNoSignal),fontSize,"Wingdings",noSignalColor);
allbuy[2]=0;
allsell[2]=0;
}
}
if(a==3)
{
if(rsibuy[3]==1 && sarbuy[3]==1 && mabuy[3]==1 && (macdbuy[3]==1 || macdbuy[3]== 2) && adxbuy[3]==1)
{
ObjectSetText("signal"+a+"5",CharToStr(allBuy),fontSize+5,"Wingdings",allBuyColor);
allbuy[3]=1;
allsell[3]=0;
}
else if(rsisell[3]==1 && sarsell[3]==1 && masell[3]==1 && (macdsell[3]==1 || macdsell[3]==2) && adxsell[3]==1)
{
ObjectSetText("signal"+a+"5",CharToStr(allSell),fontSize+5,"Wingdings",allSellColor);
allbuy[3]=0;
allsell[3]=1;
}
else
{
ObjectSetText("signal"+a+"5",CharToStr(symbolCodeNoSignal),fontSize,"Wingdings",noSignalColor);
allbuy[3]=0;
allsell[3]=0;
}
}
if(a==4)
{
if(rsibuy[4]==1 && sarbuy[4]==1 && mabuy[4]==1 && (macdbuy[4]==1 || macdbuy[4]== 2 ||macdbuy[4]==3 ) && adxbuy[4]==1)
{
ObjectSetText("signal"+a+"5",CharToStr(allBuy),fontSize+5,"Wingdings",allBuyColor);
allbuy[4]=1;
allsell[4]=0;
}
else if(rsisell[4]==1 && sarsell[4]==1 && masell[4]==1 && (macdsell[4]==1 ||macdsell[4]== 2||macdsell[4]== 3) && adxsell[4]==1)
{
ObjectSetText("signal"+a+"5",CharToStr(allSell),fontSize+5,"Wingdings",allSellColor);
allbuy[4]=0;
allsell[4]=1;
}
else
{
ObjectSetText("signal"+a+"5",CharToStr(symbolCodeNoSignal),fontSize,"Wingdings",noSignalColor);
allbuy[4]=0;
allsell[4]=0;
}
}
if(a==5)
{
if(rsibuy[5]==1 && sarbuy[5]==1 && mabuy[5]==1 && (macdbuy[5]==1 ||macdbuy[5]== 2 ||macdbuy[5]== 3 ) && adxbuy[5]==1)
{
ObjectSetText("signal"+a+"5",CharToStr(allBuy),fontSize+5,"Wingdings",allBuyColor);
allbuy[5]=1;
allsell[5]=0;
}
else if(rsisell[5]==1 && sarsell[5]==1 && masell[5]==1 && (macdsell[5]==1 || macdbuy[5]== 2||macdbuy[5]==3) && adxsell[5]==1)
{
ObjectSetText("signal"+a+"5",CharToStr(allSell),fontSize+5,"Wingdings",allSellColor);
allbuy[5]=0;
allsell[5]=1;
}
else
{
ObjectSetText("signal"+a+"5",CharToStr(symbolCodeNoSignal),fontSize,"Wingdings",noSignalColor);
allbuy[5]=0;
allsell[5]=0;
}
}
}
return(0);
}
//+------------------------------------------------------------------+
/*
switch(signal)
// Header of the 'switch'
{
// Start of the 'switch' body
case 1 : Alert("Plus one point"); break;
// Variations..
case 2 : Alert("Plus two points"); break;
case 3 : Alert("Plus three points"); break;
case 4 : Alert("Plus four points"); break;//Here are presented
case 5 : Alert("Plus five points"); break;//10 variations 'case',
case 6 : Alert("Plus six points"); break;//but, in general case,
case 7 : Alert("Plus seven points"); break;//the amount of variations 'case'
case 8 : Alert("Plus eight points"); break;//is unlimited
case 9 : Alert("Plus nine points"); break;
case 10: Alert("Plus ten points"); break;
default: Alert("More than ten points");
// It is not the same as the 'case'
}
*/
//+------------------------------------------------------------------+
//| Championship_2010_v2.mq4 |
//| avoitenko |
//| https://login.mql5.com/ru/users/avoitenko |
//+------------------------------------------------------------------+
#property copyright ""
#property link "https://login.mql5.com/ru/users/avoitenko"
#property link "http://fxmts.net/files/"
#property link "2.00"
//+------------------------------------------------------------------+
//| Input parameters |
//+------------------------------------------------------------------+
extern string General = "=== General options ===";
extern int PERIOD = 250; // Calculation period
extern int STOP_LOSS = 50; // Level of stop loss
extern int TAKE_PROFIT = 100; // Level of take profit
extern int INSIDE_LEVEL = 30; // Level back into the channel
extern int TRAILING_STOP = 20; // Trailing stop level
extern int TRAILING_STEP = 10; // Trailing step level
extern int ORDER_STEP = 10; // Step movement of a pending order
extern int SLIPPAGE = 2; // Slippage
extern double LOT = 5; // Lots
extern bool LOT_IS_FIXED = true; // Lot type
extern bool LOT_CORRECTION = false; // Correction of lot size
extern int MAGIC_NUMBER = 867; // Unique number Adviser
extern string Additional = "=== Additional options ===";
extern bool PRINT_REPORT = false; // Log output
//+------------------------------------------------------------------+
//| Global variables |
//+------------------------------------------------------------------+
int stop_loss; // stop loss
int take_profit; // take profit
int inside_level; // level back into the channel
int trailing_level; // trailing stop
int trailing_step; // trailing step
int order_step; // order step
int slippage; // slippage
double lot; // lots
//---
bool buy_open = false; // buy flag
bool sell_open = false; // sell flag
double CalcHigh; // resistance level
double CalcLow; // support level
//---
double order_open_price; // order open price
double spread; // spread
int stop_level; // minimum level of the price to install a Stop Loss / Take Profit
int order_type; // order type
int order_ticket; // order ticket
int orders_total;
double order_stop_loss;
double sl;
double tp;
double target;
double price;
string err_msg;
bool start;
bool alert;
double margin;
//+------------------------------------------------------------------+
//| initialization function of the expert |
//+------------------------------------------------------------------+
int init()
//+------------------------------------------------------------------+
{
start = true;
alert = false;
//--- Checking the calculation period
if(PERIOD < 3)
{
err_msg = "Error, invalid parameter PERIOD = " + DoubleToStr(PERIOD,0) + " allowable values >= 3";
start = false;
}
//--- Checking the stop loss value
if(STOP_LOSS <= 0)
{
err_msg = "Error, invalid parameter STOP_LOSS = " + DoubleToStr(STOP_LOSS,0) + " allowable values > 0";
start = false;
}
//--- Checking the Take Profit value
if(TAKE_PROFIT<0)
{
err_msg = "Error, invalid parameter TAKE_PROFIT = " + DoubleToStr(TAKE_PROFIT,0) + " allowable values >= 0";
start = false;
}
//--- Checking the level back into the channel
if(INSIDE_LEVEL<1)
{
err_msg = "Error, invalid parameter INSIDE_LEVEL = " + DoubleToStr(INSIDE_LEVEL,0) + " allowable values >= 1";
start = false;
}
//--- Checking the trailing stop value
if(TRAILING_STOP<0)
{
err_msg = "Error, invalid parameter TRAILING_STOP = " + DoubleToStr(TRAILING_STOP,0) + " allowable values >= 0";
start = false;
}
//--- Checking step move the trailing stop
if(TRAILING_STEP < 0)
{
err_msg = "Error, invalid parameter TRAILING_STEP = " + DoubleToStr(TRAILING_STEP,0) + " allowable values >= 0";
start = false;
}
//---
if(TRAILING_STEP > TRAILING_STOP)
{
err_msg = "Error, invalid parameter TRAILING_STEP = " + DoubleToStr(TRAILING_STEP,0) + " allowable values < TRAILING_STOP";
start = false;
}
//--- Checking the step movement of a pending order
if(ORDER_STEP<0)
{
err_msg = "Error, invalid parameter ORDER_STEP = " + DoubleToStr(ORDER_STEP,0) + " allowable values >=0";
start = false;
}
//--- Checking slippage
if(SLIPPAGE<0)
{
err_msg = "Error, invalid parameter SLIPPAGE = " + DoubleToStr(SLIPPAGE,0) + " allowable values >=0";
start = false;
}
//---
if(!OrderCalcMargin(Symbol(),1,Ask,margin) && !LOT_IS_FIXED)
{
err_msg = "Error, For this symbol" + Symbol() +" can only trade in fixed lot: LOT_IS_FIXED = true";
start = false;
}
//---
stop_loss = STOP_LOSS;
take_profit = TAKE_PROFIT;
inside_level = INSIDE_LEVEL;
trailing_level = TRAILING_STOP;
trailing_step = TRAILING_STEP;
slippage = SLIPPAGE;
order_step = ORDER_STEP;
//--- If the price includes 3 / 5 decimal places
if(Digits == 3 || Digits == 5)
{
stop_loss = stop_loss * 10;
take_profit = take_profit * 10;
inside_level = inside_level * 10;
trailing_level = trailing_level * 10;
trailing_step = trailing_step * 10;
slippage = slippage * 10;
order_step = order_step * 10;
}
start();
return(0);
}
//+------------------------------------------------------------------+
//| the main function of the expert |
//+------------------------------------------------------------------+
int start()
//+------------------------------------------------------------------+
{
if(!IsExpertEnabled() && !IsTesting())
{
err_msg = "Warning: Job advisor is not allowed. Please click \"Expert Advisors\"";
start=false;
}
//--- If there is an error in the values of external variables, then - exit
if(!start)
{
if(!alert)
{
Alert("Error input variables àdviser","\n",err_msg);
Print(err_msg);
alert=true;
}
return(-1);
}
//--- Check availability of historical data for M5 timeframe
if(iBars(Symbol(), PERIOD_M5) < PERIOD)
{
Print("Little historical data for trade");
return;
}
//--- Retrieving array data High and Low
else
{
//--- Finding the minimum and maximum
CalcHigh = 0.0;
CalcLow = 0.0;
int high_index = iHighest(Symbol(), PERIOD_M5, MODE_HIGH, PERIOD,0);
int low_index = iLowest(Symbol(), PERIOD_M5, MODE_LOW, PERIOD,0);
CalcHigh = iHigh(Symbol(), PERIOD_M5, high_index);
CalcLow = iLow(Symbol(), PERIOD_M5, low_index);
}
//--- Exit if CalcHigh and CalcLow not counted
if(CalcHigh < Point || CalcLow < Point) return;
//--- Upgrade options
stop_level = MarketInfo(Symbol(),MODE_STOPLEVEL);
spread = NormalizeDouble(Ask - Bid, Digits);
//--- The conditions of return inside the channel
if(Ask <= NormalizeDouble(CalcHigh - inside_level * Point, Digits)) buy_open = true;
if(Bid >= NormalizeDouble(CalcLow + inside_level * Point, Digits)) sell_open = true;
//--- Processing of open orders
WorkWithPositions();
//--- Processing of pending orders
WorkWithPendidngOrders();
//--- Set a new pending order to buy
if(buy_open) OpenOrderBuyStop();
//--- Set a new pending order to sell
if(sell_open) OpenOrderSellStop();
return(0);
}
//+------------------------------------------------------------------+
//| Working with the positions |
//+------------------------------------------------------------------+
void WorkWithPositions()
//+------------------------------------------------------------------+
{
orders_total = OrdersTotal();
for(int pos = orders_total-1; pos>=0; pos--)
{
if(OrderSelect(pos, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() != Symbol() || OrderMagicNumber() != MAGIC_NUMBER) continue; //not my order
{
order_open_price = OrderOpenPrice();
order_type = OrderType();
order_stop_loss = OrderStopLoss();
order_ticket = OrderTicket();
if(order_type == OP_BUY)
{
buy_open = false;
//--- Trailing stop
if(order_stop_loss == 0 || trailing_level == 0 || trailing_step == 0) continue; // condition under which the trailing stop is not working
target = NormalizeDouble(MathMax(order_open_price, order_stop_loss) + trailing_level*Point, Digits);
if(Bid > target)
{
if(order_stop_loss < order_open_price)
{
if(OrderModify(order_ticket, order_open_price, order_open_price, OrderTakeProfit(), 0, Blue))
if(PRINT_REPORT)Print("Moving stop loss order Buy #", order_ticket);
else
if(PRINT_REPORT)Print("Error moving stop loss order Buy #", order_ticket);
}
else
{
sl=NormalizeDouble(order_stop_loss + trailing_step*Point,Digits);
if(OrderModify(order_ticket, order_open_price, sl, OrderTakeProfit(), 0, Blue))
if(PRINT_REPORT)Print("Moving stop loss order Buy #", order_ticket);
else
if(PRINT_REPORT)Print("Error moving stop loss order Buy #", order_ticket);
}
Sleep(2000);
RefreshRates();
}
continue;
}// end OP_BUY
else if(order_type == OP_SELL)
{
sell_open = false;
//--- Trailing Stop
if(order_stop_loss == 0 || trailing_level == 0 || trailing_step == 0) continue;
target = NormalizeDouble(MathMin(order_open_price, order_stop_loss) - trailing_level*Point, Digits);
if(Ask < target)
{
if(order_stop_loss > order_open_price)
{
if(OrderModify(order_ticket, order_open_price, order_open_price, OrderTakeProfit(),0,Blue))
if(PRINT_REPORT)Print("Moving stop loss order Sell #",order_ticket);
else
if(PRINT_REPORT)Print("Error moving stop loss order Sell #",order_ticket);
}
else
{
sl = NormalizeDouble(order_stop_loss - trailing_step * Point,Digits);
if(OrderModify(order_ticket, order_open_price, sl, OrderTakeProfit(),0,Blue))
if(PRINT_REPORT)Print("Moving stop loss order Sell #",order_ticket);
else
if(PRINT_REPORT)Print("Error moving stop loss order Sell #",order_ticket);
}
Sleep(2000);
RefreshRates();
}
}// end OP_SELL
}// end if
}// end if select
}// end for
}
//+------------------------------------------------------------------+
//| Working with pending orders |
//+------------------------------------------------------------------+
void WorkWithPendidngOrders()
//+------------------------------------------------------------------+
{
//--- Processing pending orders
for(int pos=0; pos < OrdersTotal(); pos++)
{
if(OrderSelect(pos,SELECT_BY_POS,MODE_TRADES))
{
if( OrderSymbol() != Symbol() || OrderMagicNumber() != MAGIC_NUMBER) continue;//not my order
order_ticket = OrderTicket();
order_type = OrderType();
order_open_price = OrderOpenPrice();
if(order_type == OP_BUYSTOP)
{
buy_open = false;
//--- Conditions for the movement of a pending order
if(( NormalizeDouble(CalcHigh - order_step * Point + spread, Digits) < NormalizeDouble(order_open_price - order_step * Point + spread, Digits)) &&
( NormalizeDouble(CalcHigh - order_step * Point + spread, Digits) > Ask + stop_level * Point))
{
price = NormalizeDouble(CalcHigh - order_step * Point + spread, Digits);
if(stop_loss == 0) sl = 0;
else sl = NormalizeDouble(CalcHigh - order_step * Point - MathMax(stop_loss, stop_level) * Point, Digits);
if(take_profit == 0) tp = 0;
else tp = NormalizeDouble(CalcHigh - order_step * Point + MathMax(take_profit, stop_level) * Point, Digits);
if (OrderModify(order_ticket, price, sl, tp, 0))
if(PRINT_REPORT)Print("Modified order BuyStop # ",order_ticket);
else
if(PRINT_REPORT)Print("Error modified order BuyStop # ",order_ticket);
Sleep(2000);
RefreshRates();
}
}//end ORDER_TYPE_BUY_STOP
else if(order_type == OP_SELLSTOP)
{
sell_open = false;
//--- Conditions for the movement of a pending order
if(( NormalizeDouble(CalcLow + order_step * Point, Digits) > order_open_price + order_step * Point)&&
( NormalizeDouble(CalcLow + order_step * Point, Digits) < Bid - stop_level * Point))
{
price = NormalizeDouble(CalcLow + order_step * Point, Digits);
if(stop_loss == 0) sl = 0;
else sl = NormalizeDouble(price + MathMax(stop_loss * Point, stop_level * Point) + spread, Digits);
if(take_profit == 0) tp = 0;
else tp = NormalizeDouble(price - MathMax(take_profit * Point, stop_level * Point) + spread, Digits);
if (OrderModify(OrderTicket(), price, sl, tp, 0))
if(PRINT_REPORT)Print("Modified order SellStop # ",order_ticket);
else
if(PRINT_REPORT)Print("Error modified order SellStop # ",GetLastError());
Sleep(2000);
RefreshRates();
}
}//end ORDER_TYPE_SELL_STOP
}// end order_ticket
}// end for
}
//+------------------------------------------------------------------+
//| Set the pending order to buy |
//+------------------------------------------------------------------+
void OpenOrderBuyStop()
//+------------------------------------------------------------------+
{
lot = Calculate_Lot(LOT, LOT_IS_FIXED, OP_BUY); //Do not specify ORDER_TYPE_BUY_STOP. This constant is not processed in OrderCalcMargin!
price = NormalizeDouble(CalcHigh - order_step * Point, Digits);
//--- adjust the price of orders
if(NormalizeDouble(Ask + stop_level * Point, Digits) > price) return(0);//price = NormalizeDouble(Ask + stop_level * Point, Digits);
//--- Calculation of stop loss
if(stop_loss == 0) sl = 0;
else sl = NormalizeDouble(price - MathMax(stop_loss, stop_level) * Point - spread, Digits);
//--- Calculation of take profit
if(take_profit == 0) tp = 0;
else tp = NormalizeDouble(price + MathMax(take_profit, stop_level) * Point - spread, Digits);
if(OrderSend(Symbol(), OP_BUYSTOP, lot, price, 0, sl, tp, DoubleToStr(MAGIC_NUMBER,0), MAGIC_NUMBER, 0, Blue) >= 0)
{
buy_open = false;
if(PRINT_REPORT)Print("Opened an order BuyStop #" + DoubleToStr(OrderTicket(),0));
}
else
{
if(PRINT_REPORT)Print("Error opened an order BuyStop, error code:" + GetLastError());
}
Sleep(2000);
RefreshRates();
}
//+------------------------------------------------------------------+
//| Set the pending order to sell |
//+------------------------------------------------------------------+
void OpenOrderSellStop()
//+------------------------------------------------------------------+
{
lot = Calculate_Lot(LOT, LOT_IS_FIXED, OP_SELL); //Do not specify ORDER_TYPE_SELL_STOP. This constant is not processed in OrderCalcMargin!
price = NormalizeDouble(CalcLow + order_step * Point, Digits);
//--- adjust the price of orders
if(NormalizeDouble(Bid - stop_level * Point, Digits) < price) return(0);//price = NormalizeDouble(Bid - stop_level * Point, Digits);
//--- The calculation of stop loss
if(stop_loss == 0) sl = 0;
else sl = NormalizeDouble(price + MathMax(stop_loss, stop_level)* Point + spread, Digits);
//--- The calculation of take profit
if(take_profit == 0) tp = 0;
else tp = NormalizeDouble(price - MathMax(take_profit, stop_level) * Point + spread, Digits);
if(OrderSend( Symbol(), OP_SELLSTOP, lot, price, 0, sl, tp, DoubleToStr(MAGIC_NUMBER,0),MAGIC_NUMBER, 0, Blue)>=0)
{
sell_open = false;
if(PRINT_REPORT)Print("Opened an order SellStop #" + DoubleToStr(OrderTicket(),0));
}
else
{
if(PRINT_REPORT)Print("Error opened an order SellStop, error code:" + GetLastError());
}
Sleep(2000);
RefreshRates();
}
//+------------------------------------------------------------------+
//| Calculation of the lot |
//+------------------------------------------------------------------+
double Calculate_Lot(double lot_value, bool lot_is_fixed, int direction)
//+------------------------------------------------------------------+
{
double acc_free_margin = AccountFreeMargin();
double calc_margin;
double price = 0;
if(direction == OP_BUY) price = Ask;
if(direction == OP_SELL) price = Bid;
if(lot_is_fixed)
{
if(LOT_CORRECTION)//--- Correction of lot size
{
OrderCalcMargin(Symbol(), lot_value, price, calc_margin);
//--- Lot size correction of up to 90% of free margin
if(acc_free_margin < calc_margin)
{
lot_value = lot_value * acc_free_margin * 0.9 / calc_margin;
if(PRINT_REPORT)Print("Adjusted value of the lot: ",lot);
}
}
}
else
{
//--- value of free margin for open position
OrderCalcMargin(Symbol(), 1, price, calc_margin);
lot_value = acc_free_margin * 0.01 * LOT / calc_margin;
}
return(NormalizeLot(lot_value));
}
//+------------------------------------------------------------------+
//| Normalization of the lot size |
//+------------------------------------------------------------------+
double NormalizeLot(double lot_value)
//+------------------------------------------------------------------+
{
double lot_min = MarketInfo(Symbol(), MODE_MINLOT);
double lot_max = MarketInfo(Symbol(), MODE_MAXLOT);
double lot_step = MarketInfo(Symbol(), MODE_LOTSTEP);
if(lot_value <= lot_min ) lot_value = lot_min; // checking for minimum lot
else if(lot_value >= lot_max ) lot_value = lot_max; // checking the maximum lot
else lot_value = MathFloor(lot_value / lot_step) * lot_step; // rounding to the nearest
return (NormalizeDouble(lot_value,2)); // normalization
}
//+------------------------------------------------------------------+
//| Calculation of the free margin |
//| Applies only for standard Forex symbol |
//+------------------------------------------------------------------+
bool OrderCalcMargin(string symbol, // Symbol name
double volume, // Lots
double price, // Open price
double& margin) // output value
//+------------------------------------------------------------------+
{
string first = StringSubstr(symbol,0,3);
string second = StringSubstr(symbol,3,3);
string currency = AccountCurrency();
double leverage = AccountLeverage();
double contract = MarketInfo(symbol, MODE_LOTSIZE);
margin = 0.0;
//---
if(StringLen(symbol) != 6)
{
Print("OrderCalcMargin: ",symbol," - must be a standard forex symbol by type: XXXYYY");
return(false);
}
//---
if( price <= 0.0 || contract <= 0)
{
Print("OrderCalcMargin: No market information for ",symbol);
return(false);
}
//---
if(first == currency)
{
margin=contract * volume / leverage; // USDxxx
return(true);
}
//---
if((second == currency))
{
margin=contract * price * volume / leverage; // xxxUSD
return(true);
}
//---
Print("OrderCalcMargin: impossible to calculate for ",symbol);
return(false);
}
//+------------------------------------------------------------------+
//| FX Multi-Meter II |
//| Copyright � 2009, J.Arent |
//| josharent@yahoo.com.au |
//| |
//| Inspired by !x-meter (Special thanks to R. Hill) |
//+------------------------------------------------------------------+
#property copyright "�J.Arent 2009"
extern string Title1 = "== History Line =======================";
extern bool DisplayHistoryLine = true;
extern color LineColor = DimGray;
extern string Title2 = "== Compact Mode ====================";
extern bool DisplayCompact = false;
extern string Title3 = "== Display Price/Chart/Currency =========";
extern bool DisplayPriceInfo = false;
extern int PriceFontSize = 32;
extern color PriceColor = White;
extern int ChartFontSize = 16;
extern color ChartColor = DimGray;
extern string DisplayOptions = "== Use Monthly Chart for Options ======";
extern bool DisableMonthly = true;
extern string Title4 = "== Processing Latency (Sleep) ==========";
extern string LatencyDescription1 = "Higher values reduce flickering.";
extern string LatencyDescription2 = "Lower values increase responsiveness.";
extern int Latency = 100;
extern string Title5 = "== Trend-O-Graph ====================";
extern string MA_Types = "0=SMA, 1=EMA, 2=SMMA, 4=LWMA";
extern bool DisplayTrendGraph = true;
extern int MA_Type = 2;
extern int MA1_Period = 3;
extern int MA2_Period = 5;
extern int MA3_Period = 10;
extern int MA4_Period = 20;
extern int MA5_Period = 50;
extern int MA6_Period = 100;
extern int MA7_Period = 200;
extern string Title6 = "== Overall Signal =====================";
extern string CurrentIndicators = "Current Indicators";
extern bool Include_MAXover = true;
extern bool Include_MACD = true;
extern bool Include_PSAR = true;
extern bool Include_MA = true;
extern bool Include_STOCH = true;
extern bool Include_WPR = true;
extern bool Include_PriceDirection = true;
extern string MultiIndicators = "Multi-Timeframe Indicators";
extern bool Include_M1_MA = false;
extern bool Include_M5_MA = false;
extern bool Include_M15_MA = false;
extern bool Include_M30_MA = false;
extern bool Include_H1_MA = false;
extern bool Include_H4_MA = false;
extern bool Include_D1_MA = false;
extern string Title7 = "== OB/OS Signal Map =================";
extern string OBOSDescription1 = "Grey = OB/OS, Green = BUY, Red = SELL.";
extern int Stochastic_BUY = 20;
extern int Stochastic_SELL = 80;
extern int WilliamsPercentRange_BUY = -80;
extern int WilliamsPercentRange_SELL = -20;
extern int MoneyFlowIndex_BUY = 20;
extern int MoneyFlowIndex_SELL = 80;
extern int CommodityChannelIndex_BUY = -100;
extern int CommodityChannelIndex_SELL = 100;
extern int RelativeStrengthIndex_BUY = 30;
extern int RelativeStrengthIndex_SELL = 70;
extern int BollingerBand_Period = 20;
extern int BollingerBand_Deviation = 2;
extern string Title8 = "== Indicator Values =====================";
extern string Title9 = "Stochastic Oscillators";
extern int Stoch_K = 14;
extern int Stoch_D = 3;
extern int Stoch_Slowing = 3;
extern string Title10 = "Moving Average Trend-Bar";
extern string TrendBar_MA_Types = "0=SMA, 1=EMA, 2=SMMA, 4=LWMA";
extern int TrendBar_MA_Type = 1;
extern int MA_Period = 14;
extern int MA_Shift = 0;
extern string Title11 = "MACD";
extern int MACD_Period1 = 12;
extern int MACD_Period2 = 26;
extern int MACD_Period3 = 9;
extern string Title12 = "MA-Xover";
extern int FastLWMA = 3;
extern int SlowSMA = 5;
extern string Title13 = "Parabolic SAR";
extern double PSAR_Step = 0.02;
extern double PSAR_Max = 0.2;
string HistoryLine = "History Line";
//+------------------------------------------------------------------+
// expert initialization function |
//+------------------------------------------------------------------+
int init()
{
int err,lastError;
//----
if (DisplayHistoryLine)
{if (ObjectFind(HistoryLine)==-1)
{
ObjectCreate(HistoryLine,OBJ_VLINE,0,Time[0]+300,Close[0]);
ObjectSet(HistoryLine,OBJPROP_COLOR,LineColor);
}
}
initGraph();
while (true)
{
if (IsConnected()) main();
if (!IsConnected()) objectBlank();
if (DisableMonthly) {if(Period()==PERIOD_MN1) break;}
WindowRedraw();
Sleep(Latency);
}
//----
return(0);
}
//+------------------------------------------------------------------+
// expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
ObjectsDeleteAll(0,OBJ_LABEL);
Print("shutdown error - ",GetLastError());
//----
return(0);
}
//+------------------------------------------------------------------+
// expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
// expert custom function |
//+------------------------------------------------------------------+
void main()
{
RefreshRates();
//History Line ----------------------------------------------------
int BarShift,BarShift2,BarShiftM1,BarShiftM5,BarShiftM15,BarShiftM30,BarShiftH1,BarShiftH4,BarShiftD1;
if (DisplayHistoryLine)
{
datetime VLineTime=ObjectGet(HistoryLine,OBJPROP_TIME1);
if (VLineTime>=Time[0]) {BarShift=0;}
if (Period()==PERIOD_M1 && VLineTime<Time[0])
{
BarShift2=(Time[0] - VLineTime)/60;
BarShift=((Time[0] - VLineTime)/60) + (BarShift2-((Time[0]-Time[BarShift2])/60));
}
if (Period()==PERIOD_M5 && VLineTime<Time[0])
{
BarShift2=(Time[0] - VLineTime)/300;
BarShift=((Time[0] - VLineTime)/300) + (BarShift2-((Time[0]-Time[BarShift2])/300));
}
if (Period()==PERIOD_M15 && VLineTime<Time[0])
{
BarShift2=(Time[0] - VLineTime)/900;
BarShift=((Time[0] - VLineTime)/900) + (BarShift2-((Time[0]-Time[BarShift2])/900));
}
if (Period()==PERIOD_M30 && VLineTime<Time[0])
{
BarShift2=(Time[0] - VLineTime)/1800;
BarShift=((Time[0] - VLineTime)/1800) + (BarShift2-((Time[0]-Time[BarShift2])/1800));
}
if (Period()==PERIOD_H1 && VLineTime<Time[0])
{
BarShift2=(Time[0] - VLineTime)/3600;
BarShift=((Time[0] - VLineTime)/3600) + (BarShift2-((Time[0]-Time[BarShift2])/3600));
}
if (Period()==PERIOD_H4 && VLineTime<Time[0])
{
BarShift2=(Time[0] - VLineTime)/14400;
BarShift=((Time[0] - VLineTime)/14400) + (BarShift2-((Time[0]-Time[BarShift2])/14400));
}
if (Period()==PERIOD_D1 && VLineTime<Time[0])
{
BarShift2=(Time[0] - VLineTime)/86400;
BarShift=((Time[0] - VLineTime)/86400) + (BarShift2-((Time[0]-Time[BarShift2])/86400));
}
if (Period()==PERIOD_W1 && VLineTime<Time[0])
{
BarShift2=(Time[0] - VLineTime)/604800;
BarShift=((Time[0] - VLineTime)/604800) + (BarShift2-((Time[0]-Time[BarShift2])/604800));
}
if (Period()==PERIOD_MN1 && VLineTime<Time[0])
{
BarShift2=(Time[0] - VLineTime)/(PERIOD_MN1*60);
BarShift=((Time[0] - VLineTime)/(PERIOD_MN1*60)) + (BarShift2-((Time[0]-Time[BarShift2])/(PERIOD_MN1*60)));
}
Print ("BarShift = ",BarShift);
//Print ("BarShift2 = ",BarShift2);
if (VLineTime>=Time[0]) {BarShiftM1=0;}
if (VLineTime<Time[0])
{
BarShiftM1=(Time[0] - VLineTime)/60;
}
if (VLineTime>=Time[0]) {BarShiftM5=0;}
if (VLineTime<Time[0])
{
BarShiftM5=(Time[0] - VLineTime)/300;
}
if (VLineTime>=Time[0]) {BarShiftM15=0;}
if (VLineTime<Time[0])
{
BarShiftM15=(Time[0] - VLineTime)/900;
}
if (VLineTime>=Time[0]) {BarShiftM30=0;}
if (VLineTime<Time[0])
{
BarShiftM30=(Time[0] - VLineTime)/1800;
}
if (VLineTime>=Time[0]) {BarShiftH1=0;}
if (VLineTime<Time[0])
{
BarShiftH1=(Time[0] - VLineTime)/3600;
}
if (VLineTime>=Time[0]) {BarShiftH4=0;}
if (VLineTime<Time[0])
{
BarShiftH4=(Time[0] - VLineTime)/14400;
}
if (VLineTime>=Time[0]) {BarShiftD1=0;}
if (VLineTime<Time[0])
{
BarShiftD1=(Time[0] - VLineTime)/86400;
}
}
else if (!DisplayHistoryLine)
{BarShift=0; BarShiftM1=0; BarShiftM5=0; BarShiftM15=0; BarShiftM30=0; BarShiftH1=0; BarShiftH4=0; BarShiftD1=0;}
if (ObjectFind(HistoryLine)==-1) {BarShift=0; BarShiftM1=0; BarShiftM5=0; BarShiftM15=0; BarShiftM30=0; BarShiftH1=0; BarShiftH4=0; BarShiftD1=0;}
// Variables -------------------
double M1stochK,M1stochD,M5stochK,M5stochD,M15stochK,M15stochD,M30stochK,M30stochD,H1stochK,H1stochD,H4stochK,H4stochD,D1stochK,D1stochD,StochK,StochD,StochKprev,StochDprev;
double M1stochKprev,M5stochKprev,M15stochKprev,M30stochKprev,H1stochKprev,H4stochKprev,D1stochKprev,M1stochDprev,M5stochDprev,M15stochDprev,M30stochDprev,H1stochDprev,H4stochDprev,D1stochDprev;
double MAM1,MAM5,MAM15,MAM30,MAH1,MAH4,MAD1,MAM1prev,MAM5prev,MAM15prev,MAM30prev,MAH1prev,MAH4prev,MAD1prev,MACurrent,MAPrevious;
double Spread,PSARCurrent,PSARPrev,MACDCurrent,MACDPrev,MACDSignal,MACDSignalPrev,MAXover1,MAXover2,VolumePercent,Vol,VolPrev,WPR,Bar1,Bar2,Bar3,Bar4,Bar5,Bar6,Bar7,Bar8,Bar9,Bar10;
double Bar1percent,Bar2percent,Bar3percent,Bar4percent,Bar5percent,BarsAverage1,BarsAverage2,BarsAverage3,BarsAverage4,BarsAverage5,BarsAllpercent;
int trendM1,trendM5,trendM15,trendM30,trendH1,trendH4,trendD1,PSAR,MACD,MAXoverSignal,VolValue,WPRValueUp,WPRValueDown,Bar1Col,Bar2Col,Bar3Col,Bar4Col,Bar5Col,BarReading,Signal;
double TGMA1M1,TGMA1M5,TGMA1M15,TGMA1M30,TGMA1H1,TGMA1H4,TGMA1D1,TGMA2M1,TGMA2M5,TGMA2M15,TGMA2M30,TGMA2H1,TGMA2H4,TGMA2D1;
double TGMA3M1,TGMA3M5,TGMA3M15,TGMA3M30,TGMA3H1,TGMA3H4,TGMA3D1,TGMA4M1,TGMA4M5,TGMA4M15,TGMA4M30,TGMA4H1,TGMA4H4,TGMA4D1;
double TGMA5M1,TGMA5M5,TGMA5M15,TGMA5M30,TGMA5H1,TGMA5H4,TGMA5D1,TGMA6M1,TGMA6M5,TGMA6M15,TGMA6M30,TGMA6H1,TGMA6H4,TGMA6D1;
double TGMA7M1,TGMA7M5,TGMA7M15,TGMA7M30,TGMA7H1,TGMA7H4,TGMA7D1;
double TGMA1M1prev,TGMA1M5prev,TGMA1M15prev,TGMA1M30prev,TGMA1H1prev,TGMA1H4prev,TGMA1D1prev,TGMA2M1prev,TGMA2M5prev,TGMA2M15prev,TGMA2M30prev,TGMA2H1prev,TGMA2H4prev,TGMA2D1prev;
double TGMA3M1prev,TGMA3M5prev,TGMA3M15prev,TGMA3M30prev,TGMA3H1prev,TGMA3H4prev,TGMA3D1prev,TGMA4M1prev,TGMA4M5prev,TGMA4M15prev,TGMA4M30prev,TGMA4H1prev,TGMA4H4prev,TGMA4D1prev;
double TGMA5M1prev,TGMA5M5prev,TGMA5M15prev,TGMA5M30prev,TGMA5H1prev,TGMA5H4prev,TGMA5D1prev,TGMA6M1prev,TGMA6M5prev,TGMA6M15prev,TGMA6M30prev,TGMA6H1prev,TGMA6H4prev,TGMA6D1prev;
double TGMA7M1prev,TGMA7M5prev,TGMA7M15prev,TGMA7M30prev,TGMA7H1prev,TGMA7H4prev,TGMA7D1prev;
int TGMA1M1Signal,TGMA1M5Signal,TGMA1M15Signal,TGMA1M30Signal,TGMA1H1Signal,TGMA1H4Signal,TGMA1D1Signal;
int TGMA2M1Signal,TGMA2M5Signal,TGMA2M15Signal,TGMA2M30Signal,TGMA2H1Signal,TGMA2H4Signal,TGMA2D1Signal;
int TGMA3M1Signal,TGMA3M5Signal,TGMA3M15Signal,TGMA3M30Signal,TGMA3H1Signal,TGMA3H4Signal,TGMA3D1Signal;
int TGMA4M1Signal,TGMA4M5Signal,TGMA4M15Signal,TGMA4M30Signal,TGMA4H1Signal,TGMA4H4Signal,TGMA4D1Signal;
int TGMA5M1Signal,TGMA5M5Signal,TGMA5M15Signal,TGMA5M30Signal,TGMA5H1Signal,TGMA5H4Signal,TGMA5D1Signal;
int TGMA6M1Signal,TGMA6M5Signal,TGMA6M15Signal,TGMA6M30Signal,TGMA6H1Signal,TGMA6H4Signal,TGMA6D1Signal;
int TGMA7M1Signal,TGMA7M5Signal,TGMA7M15Signal,TGMA7M30Signal,TGMA7H1Signal,TGMA7H4Signal,TGMA7D1Signal;
double OBOSRSIM1,OBOSRSIM5,OBOSRSIM15,OBOSRSIM30,OBOSRSIH1,OBOSRSIH4,OBOSRSID1,OBOSRSIM1prev,OBOSRSIM5prev,OBOSRSIM15prev,OBOSRSIM30prev,OBOSRSIH1prev,OBOSRSIH4prev,OBOSRSID1prev;
double OBOSCCIM1,OBOSCCIM5,OBOSCCIM15,OBOSCCIM30,OBOSCCIH1,OBOSCCIH4,OBOSCCID1,OBOSCCIM1prev,OBOSCCIM5prev,OBOSCCIM15prev,OBOSCCIM30prev,OBOSCCIH1prev,OBOSCCIH4prev,OBOSCCID1prev;
double OBOSMFIM1,OBOSMFIM5,OBOSMFIM15,OBOSMFIM30,OBOSMFIH1,OBOSMFIH4,OBOSMFID1,OBOSMFIM1prev,OBOSMFIM5prev,OBOSMFIM15prev,OBOSMFIM30prev,OBOSMFIH1prev,OBOSMFIH4prev,OBOSMFID1prev;
double OBOSWPRM1,OBOSWPRM5,OBOSWPRM15,OBOSWPRM30,OBOSWPRH1,OBOSWPRH4,OBOSWPRD1,OBOSWPRM1prev,OBOSWPRM5prev,OBOSWPRM15prev,OBOSWPRM30prev,OBOSWPRH1prev,OBOSWPRH4prev,OBOSWPRD1prev;
double OBOSBBHighM1,OBOSBBHighM5,OBOSBBHighM15,OBOSBBHighM30,OBOSBBHighH1,OBOSBBHighH4,OBOSBBHighD1,OBOSBBLowM1,OBOSBBLowM5,OBOSBBLowM15,OBOSBBLowM30,OBOSBBLowH1,OBOSBBLowH4,OBOSBBLowD1;
double OBOSMACDM1,OBOSMACDM5,OBOSMACDM15,OBOSMACDM30,OBOSMACDH1,OBOSMACDH4,OBOSMACDD1,OBOSMACDM1prev,OBOSMACDM5prev,OBOSMACDM15prev,OBOSMACDM30prev,OBOSMACDH1prev,OBOSMACDH4prev,OBOSMACDD1prev;
double OBOSMACDM1Signal,OBOSMACDM5Signal,OBOSMACDM15Signal,OBOSMACDM30Signal,OBOSMACDH1Signal,OBOSMACDH4Signal,OBOSMACDD1Signal,OBOSMACDM1Signalprev,OBOSMACDM5Signalprev,OBOSMACDM15Signalprev,OBOSMACDM30Signalprev,OBOSMACDH1Signalprev,OBOSMACDH4Signalprev,OBOSMACDD1Signalprev;
int OBOSRSIM1Signal,OBOSRSIM5Signal,OBOSRSIM15Signal,OBOSRSIM30Signal,OBOSRSIH1Signal,OBOSRSIH4Signal,OBOSRSID1Signal;
int OBOSBBM1Signal,OBOSBBM5Signal,OBOSBBM15Signal,OBOSBBM30Signal,OBOSBBH1Signal,OBOSBBH4Signal,OBOSBBD1Signal;
int OBOSMACM1Signal,OBOSMACM5Signal,OBOSMACM15Signal,OBOSMACM30Signal,OBOSMACH1Signal,OBOSMACH4Signal,OBOSMACD1Signal;
int OBOSSTOM1Signal,OBOSSTOM5Signal,OBOSSTOM15Signal,OBOSSTOM30Signal,OBOSSTOH1Signal,OBOSSTOH4Signal,OBOSSTOD1Signal;
int OBOSWPRM1Signal,OBOSWPRM5Signal,OBOSWPRM15Signal,OBOSWPRM30Signal,OBOSWPRH1Signal,OBOSWPRH4Signal,OBOSWPRD1Signal;
int OBOSMFIM1Signal,OBOSMFIM5Signal,OBOSMFIM15Signal,OBOSMFIM30Signal,OBOSMFIH1Signal,OBOSMFIH4Signal,OBOSMFID1Signal;
int OBOSCCIM1Signal,OBOSCCIM5Signal,OBOSCCIM15Signal,OBOSCCIM30Signal,OBOSCCIH1Signal,OBOSCCIH4Signal,OBOSCCID1Signal;
bool SignalBuy_MAXover = 0,SignalBuy_MACD = 0,SignalBuy_PSAR = 0,SignalBuy_MA = 0,SignalBuy_STOCH = 0,SignalBuy_WPR = 0,SignalBuy_Price = 0;
bool SignalSell_MAXover = 0,SignalSell_MACD = 0,SignalSell_PSAR = 0,SignalSell_MA = 0,SignalSell_STOCH = 0,SignalSell_WPR = 0,SignalSell_Price = 0;
bool M1Buy = 0,M5Buy = 0,M15Buy = 0,M30Buy = 0,H1Buy = 0,H4Buy = 0,D1Buy = 0,M1Sell = 0,M5Sell = 0,M15Sell = 0,M30Sell = 0,H1Sell = 0,H4Sell = 0,D1Sell = 0;
// Stochs ----------------------------------------------------------------------------------------------
M1stochK = iStochastic(Symbol(), PERIOD_M1, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftM1+0);
M1stochD = iStochastic(Symbol(), PERIOD_M1, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_SIGNAL, BarShiftM1+0);
M5stochK = iStochastic(Symbol(), PERIOD_M5, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftM5+0);
M5stochD = iStochastic(Symbol(), PERIOD_M5, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_SIGNAL, BarShiftM5+0);
M15stochK = iStochastic(Symbol(), PERIOD_M15, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftM15+0);
M15stochD = iStochastic(Symbol(), PERIOD_M15, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_SIGNAL, BarShiftM15+0);
M30stochK = iStochastic(Symbol(), PERIOD_M30, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftM30+0);
M30stochD = iStochastic(Symbol(), PERIOD_M30, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_SIGNAL, BarShiftM30+0);
H1stochK = iStochastic(Symbol(), PERIOD_H1, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftH1+0);
H1stochD = iStochastic(Symbol(), PERIOD_H1, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_SIGNAL, BarShiftH1+0);
H4stochK = iStochastic(Symbol(), PERIOD_H4, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftH4+0);
H4stochD = iStochastic(Symbol(), PERIOD_H4, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_SIGNAL, BarShiftH4+0);
D1stochK = iStochastic(Symbol(), PERIOD_D1, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftD1+0);
D1stochD = iStochastic(Symbol(), PERIOD_D1, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_SIGNAL, BarShiftD1+0);
M1stochKprev = iStochastic(Symbol(), PERIOD_M1, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftM1+1);
M5stochKprev = iStochastic(Symbol(), PERIOD_M5, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftM5+1);
M15stochKprev = iStochastic(Symbol(), PERIOD_M15, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftM15+1);
M30stochKprev = iStochastic(Symbol(), PERIOD_M30, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftM30+1);
H1stochKprev = iStochastic(Symbol(), PERIOD_H1, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftH1+1);
H4stochKprev = iStochastic(Symbol(), PERIOD_H4, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftH4+1);
D1stochKprev = iStochastic(Symbol(), PERIOD_D1, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftD1+1);
M1stochDprev = iStochastic(Symbol(), PERIOD_M1, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftM1+1);
M5stochDprev = iStochastic(Symbol(), PERIOD_M5, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftM5+1);
M15stochDprev = iStochastic(Symbol(), PERIOD_M15, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftM15+1);
M30stochDprev = iStochastic(Symbol(), PERIOD_M30, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftM30+1);
H1stochDprev = iStochastic(Symbol(), PERIOD_H1, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftH1+1);
H4stochDprev = iStochastic(Symbol(), PERIOD_H4, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftH4+1);
D1stochDprev = iStochastic(Symbol(), PERIOD_D1, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShiftD1+1);
StochK = iStochastic(Symbol(), 0, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShift+0);
StochD = iStochastic(Symbol(), 0, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_SIGNAL, BarShift+0);
StochKprev = iStochastic(Symbol(), 0, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, BarShift+1);
StochDprev = iStochastic(Symbol(), 0, Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_SIGNAL, BarShift+1);
// MA's ----------------------------------------------------------
MAM1=iMA(NULL,PERIOD_M1,MA_Period,MA_Shift,TrendBar_MA_Type,PRICE_CLOSE,BarShiftM1+0);
MAM5=iMA(NULL,PERIOD_M5,MA_Period,MA_Shift,TrendBar_MA_Type,PRICE_CLOSE,BarShiftM5+0);
MAM15=iMA(NULL,PERIOD_M15,MA_Period,MA_Shift,TrendBar_MA_Type,PRICE_CLOSE,BarShiftM15+0);
MAM30=iMA(NULL,PERIOD_M30,MA_Period,MA_Shift,TrendBar_MA_Type,PRICE_CLOSE,BarShiftM30+0);
MAH1=iMA(NULL,PERIOD_H1,MA_Period,MA_Shift,TrendBar_MA_Type,PRICE_CLOSE,BarShiftH1+0);
MAH4=iMA(NULL,PERIOD_H4,MA_Period,MA_Shift,TrendBar_MA_Type,PRICE_CLOSE,BarShiftH4+0);
MAD1=iMA(NULL,PERIOD_D1,MA_Period,MA_Shift,TrendBar_MA_Type,PRICE_CLOSE,BarShiftD1+0);
MAM1prev=iMA(NULL,PERIOD_M1,MA_Period,MA_Shift,TrendBar_MA_Type,PRICE_CLOSE,BarShiftM1+1);
MAM5prev=iMA(NULL,PERIOD_M5,MA_Period,MA_Shift,TrendBar_MA_Type,PRICE_CLOSE,BarShiftM5+1);
MAM15prev=iMA(NULL,PERIOD_M15,MA_Period,MA_Shift,TrendBar_MA_Type,PRICE_CLOSE,BarShiftM15+1);
MAM30prev=iMA(NULL,PERIOD_M30,MA_Period,MA_Shift,TrendBar_MA_Type,PRICE_CLOSE,BarShiftM30+1);
MAH1prev=iMA(NULL,PERIOD_H1,MA_Period,MA_Shift,TrendBar_MA_Type,PRICE_CLOSE,BarShiftH1+1);
MAH4prev=iMA(NULL,PERIOD_H4,MA_Period,MA_Shift,TrendBar_MA_Type,PRICE_CLOSE,BarShiftH4+1);
MAD1prev=iMA(NULL,PERIOD_D1,MA_Period,MA_Shift,TrendBar_MA_Type,PRICE_CLOSE,BarShiftD1+1);
MACurrent=iMA(NULL,0,MA_Period,MA_Shift,TrendBar_MA_Type,PRICE_CLOSE,BarShift+0);
MAPrevious=iMA(NULL,0,MA_Period,MA_Shift,TrendBar_MA_Type,PRICE_CLOSE,BarShift+1);
// ----------------------------------------------------------------
if(MAM1 > MAM1prev)
{
trendM1=1;
}
if(MAM1 < MAM1prev)
{
trendM1=0;
}
if(MAM5 > MAM5prev)
{
trendM5=1;
}
if(MAM5 < MAM5prev)
{
trendM5=0;
}
if(MAM15 > MAM15prev)
{
trendM15=1;
}
if(MAM15 < MAM15prev)
{
trendM15=0;
}
if(MAM30 > MAM30prev)
{
trendM30=1;
}
if(MAM30 < MAM30prev)
{
trendM30=0;
}
if(MAH1 > MAH1prev)
{
trendH1=1;
}
if(MAH1 < MAH1prev)
{
trendH1=0;
}
if(MAH4 > MAH4prev)
{
trendH4=1;
}
if(MAH4 < MAH4prev)
{
trendH4=0;
}
if(MAD1 > MAD1prev)
{
trendD1=1;
}
if(MAD1 < MAD1prev)
{
trendD1=0;
}
// Spread ---------------
Spread=NormalizeDouble(((Ask-Bid)/Point)/10,1);
// ParabolicSAR -------------------------------
PSARCurrent= iSAR(NULL,0,PSAR_Step,PSAR_Max,BarShift+0);
PSARPrev= iSAR(NULL,0,PSAR_Step,PSAR_Max,BarShift+1);
if (PSARCurrent<Close[BarShift+0])
{
PSAR=1;
}
if (PSARCurrent>Close[BarShift+0])
{
PSAR=0;
}
// MACD ---------------------------------------
MACDCurrent = iMACD(NULL,0,MACD_Period1,MACD_Period2,MACD_Period3,PRICE_CLOSE,MODE_MAIN,BarShift+0);
MACDPrev = iMACD(NULL,0,MACD_Period1,MACD_Period2,MACD_Period3,PRICE_CLOSE,MODE_MAIN,BarShift+1);
MACDSignal = iMACD(NULL,0,MACD_Period1,MACD_Period2,MACD_Period3,PRICE_CLOSE,MODE_SIGNAL,BarShift+0);
MACDSignalPrev = iMACD(NULL,0,MACD_Period1,MACD_Period2,MACD_Period3,PRICE_CLOSE,MODE_SIGNAL,BarShift+1);
if (MACDCurrent>MACDPrev && ((MACDCurrent && MACDPrev)>MACDSignal || (MACDCurrent && MACDPrev)<MACDSignal))
{
MACD=3;
}
if (MACDCurrent<MACDSignal && MACDPrev>MACDSignalPrev)
{
MACD=2;
}
if (MACDCurrent<MACDPrev && ((MACDCurrent && MACDPrev)>MACDSignal || (MACDCurrent && MACDPrev)<MACDSignal))
{
MACD=1;
}
if (MACDCurrent>MACDSignal && MACDPrev<MACDSignalPrev)
{
MACD=0;
}
if (MACDCurrent>0 && MACDPrev<0)
{
MACD=4;
}
if (MACDCurrent<0 && MACDPrev>0)
{
MACD=5;
}
// MA XOVER ---------------------------------------
MAXover1=iMA(NULL,0,FastLWMA,0,MODE_LWMA,PRICE_CLOSE,BarShift+0);
MAXover2=iMA(NULL,0,SlowSMA,0,MODE_SMA,PRICE_CLOSE,BarShift+0);
if (MAXover1>MAXover2)
{
MAXoverSignal=1;
}
if (MAXover1<MAXover2)
{
MAXoverSignal=0;
}
// Williams%Range ---------------------------------
WPR=iWPR(NULL,0,14,BarShift+0);
if (WPR<=0 && WPR>=-5)
{
WPRValueUp=1;
}
if (WPR>=-20 && WPR<-5)
{
WPRValueUp=2;
}
if (WPR>=-30 && WPR<-20)
{
WPRValueUp=3;
}
if (WPR>=-40 && WPR<-30)
{
WPRValueUp=4;
}
if (WPR>-50 && WPR<-40)
{
WPRValueUp=5;
}
if (WPR<-50 && WPR>=-60)
{
WPRValueDown=6;
}
if (WPR<=-60 && WPR>=-70)
{
WPRValueDown=7;
}
if (WPR<=-70 && WPR>=-80)
{
WPRValueDown=8;
}
if (WPR<=-80 && WPR>=-95)
{
WPRValueDown=9;
}
if (WPR<=-95 && WPR>=-100)
{
WPRValueDown=10;
}
// BarMeter ---------------------------------------------------------
if (Close[BarShift+0] > Close[BarShift+1])
{
Bar1 = (Close[BarShift+0] - Close[BarShift+1])*100000;
}
if (Close[BarShift+0] < Close[BarShift+1])
{
Bar1 = (Close[BarShift+1] - Close[BarShift+0])*100000;
}
if (Close[BarShift+1] > Close[BarShift+2])
{
Bar2 = (Close[BarShift+1] - Close[BarShift+2])*100000;
}
if (Close[BarShift+1] < Close[BarShift+2])
{
Bar2 = (Close[BarShift+2] - Close[BarShift+1])*100000;
}
if (Close[BarShift+2] > Close[BarShift+3])
{
Bar3 = (Close[BarShift+2] - Close[BarShift+3])*100000;
}
if (Close[BarShift+2] < Close[BarShift+3])
{
Bar3 = (Close[BarShift+3] - Close[BarShift+2])*100000;
}
if (Close[BarShift+3] > Close[BarShift+4])
{
Bar4 = (Close[BarShift+3] - Close[BarShift+4])*100000;
}
if (Close[BarShift+3] < Close[BarShift+4])
{
Bar4 = (Close[BarShift+4] - Close[BarShift+3])*100000;
}
if (Close[BarShift+4] > Close[BarShift+5])
{
Bar5 = (Close[BarShift+4] - Close[BarShift+5])*100000;
}
if (Close[BarShift+4] < Close[BarShift+5])
{
Bar5 = (Close[BarShift+5] - Close[BarShift+4])*100000;
}
if (Close[BarShift+5] > Close[BarShift+6])
{
Bar6 = (Close[BarShift+5] - Close[BarShift+6])*100000;
}
if (Close[BarShift+5] < Close[BarShift+6])
{
Bar6 = (Close[BarShift+6] - Close[BarShift+5])*100000;
}
if (Close[BarShift+6] > Close[BarShift+7])
{
Bar7 = (Close[BarShift+6] - Close[BarShift+7])*100000;
}
if (Close[BarShift+6] < Close[BarShift+7])
{
Bar7 = (Close[BarShift+7] - Close[BarShift+6])*100000;
}
if (Close[BarShift+7] > Close[BarShift+8])
{
Bar8 = (Close[BarShift+7] - Close[BarShift+8])*100000;
}
if (Close[BarShift+7] < Close[BarShift+8])
{
Bar8 = (Close[BarShift+8] - Close[BarShift+7])*100000;
}
if (Close[BarShift+8] > Close[BarShift+9])
{
Bar9 = (Close[BarShift+8] - Close[BarShift+9])*100000;
}
if (Close[BarShift+8] < Close[BarShift+9])
{
Bar9 = (Close[BarShift+9] - Close[BarShift+8])*100000;
}
if (Close[BarShift+9] > Close[BarShift+10])
{
Bar10 = (Close[BarShift+9] - Close[BarShift+10])*100000;
}
if (Close[BarShift+9] < Close[BarShift+10])
{
Bar10 = (Close[BarShift+10] - Close[BarShift+9])*100000;
}
//----------------------------------------
BarsAverage1 = (Bar2 + Bar3 + Bar4 + Bar5)/4;
BarsAverage2 = (Bar3 + Bar4 + Bar5 + Bar6)/4;
BarsAverage3 = (Bar4 + Bar5 + Bar6 + Bar7)/4;
BarsAverage4 = (Bar5 + Bar6 + Bar7 + Bar8)/4;
BarsAverage5 = (Bar6 + Bar7 + Bar8 + Bar9)/4;
Bar1percent = NormalizeDouble((Bar1/BarsAverage1)*100,0);
Bar2percent = NormalizeDouble((Bar2/BarsAverage2)*100,0);
Bar3percent = NormalizeDouble((Bar3/BarsAverage3)*100,0);
Bar4percent = NormalizeDouble((Bar4/BarsAverage4)*100,0);
Bar5percent = NormalizeDouble((Bar5/BarsAverage5)*100,0);
BarsAllpercent = NormalizeDouble(((Bar2 + Bar3 + Bar4 + Bar5)/4)*100,0);
if (Bar1percent==0) //Stopped
{
BarReading = 1;
}
if (Bar1percent>Bar2percent && Bar1percent>100 && Bar1percent!=0) //Speeding Up
{
BarReading = 2;
}
if (Bar1percent<=100 && Bar1percent!=0) //Steady
{
BarReading = 3;
}
if (Bar1percent<Bar2percent && Bar2percent>100 && Bar1percent>100 && Bar1percent!=0) //Slowing Down
{
BarReading = 4;
}
//----------------------------------------
if (Bar1percent==0 || Close[BarShift+0] == Close[BarShift+1])
{
Bar1Col = 12;
}
if (Bar1percent<25 && Bar1percent>0)
{
Bar1Col = 11;
}
if (Bar1percent>=400)
{
if (Close[BarShift+0] > Close[BarShift+1])
{
Bar1Col = 1;
}
else if (Close[BarShift+0] < Close[BarShift+1]) Bar1Col = 10;
}
if (Bar1percent>=200 && Bar1percent<400)
{
if (Close[BarShift+0] > Close[BarShift+1])
{
Bar1Col = 2;
}
else if (Close[BarShift+0] < Close[BarShift+1]) Bar1Col = 9;
}
if (Bar1percent>=100 && Bar1percent<200)
{
if (Close[BarShift+0] > Close[BarShift+1])
{
Bar1Col = 3;
}
else if (Close[BarShift+0] < Close[BarShift+1]) Bar1Col = 8;
}
if (Bar1percent>=50 && Bar1percent<100)
{
if (Close[BarShift+0] > Close[BarShift+1])
{
Bar1Col = 4;
}
else if (Close[BarShift+0] < Close[BarShift+1]) Bar1Col = 7;
}
if (Bar1percent>=25 && Bar1percent<50)
{
if (Close[BarShift+0] > Close[BarShift+1])
{
Bar1Col = 5;
}
else if (Close[BarShift+0] < Close[BarShift+1]) Bar1Col = 6;
}
//--------------------------------------
if (Bar2percent==0 || Close[BarShift+1] == Close[BarShift+2])
{
Bar2Col = 12;
}
if (Bar2percent<25 && Bar2percent>0)
{
Bar2Col = 11;
}
if (Bar2percent>=400)
{
if (Close[BarShift+1] > Close[BarShift+2])
{
Bar2Col = 1;
}
else if (Close[BarShift+1] < Close[BarShift+2]) Bar2Col = 10;
}
if (Bar2percent>=200 && Bar2percent<400)
{
if (Close[BarShift+1] > Close[BarShift+2])
{
Bar2Col = 2;
}
else if (Close[BarShift+1] < Close[BarShift+2]) Bar2Col = 9;
}
if (Bar2percent>=100 && Bar2percent<200)
{
if (Close[BarShift+1] > Close[BarShift+2])
{
Bar2Col = 3;
}
else if (Close[BarShift+1] < Close[BarShift+2]) Bar2Col = 8;
}
if (Bar2percent>=50 && Bar2percent<100)
{
if (Close[BarShift+1] > Close[BarShift+2])
{
Bar2Col = 4;
}
else if (Close[BarShift+1] < Close[BarShift+2]) Bar2Col = 7;
}
if (Bar2percent>=25 && Bar2percent<50)
{
if (Close[BarShift+1] > Close[BarShift+2])
{
Bar2Col = 5;
}
else if (Close[BarShift+1] < Close[BarShift+2]) Bar2Col = 6;
}
//--------------------------------------
if (Bar3percent==0 || Close[BarShift+2] == Close[BarShift+3])
{
Bar3Col = 12;
}
if (Bar3percent<25 && Bar3percent>0)
{
Bar3Col = 11;
}
if (Bar3percent>=400)
{
if (Close[BarShift+2] > Close[BarShift+3])
{
Bar3Col = 1;
}
else if (Close[BarShift+2] < Close[BarShift+3]) Bar3Col = 10;
}
if (Bar3percent>=200 && Bar3percent<400)
{
if (Close[BarShift+2] > Close[BarShift+3])
{
Bar3Col = 2;
}
else if (Close[BarShift+2] < Close[BarShift+3]) Bar3Col = 9;
}
if (Bar3percent>=100 && Bar3percent<200)
{
if (Close[BarShift+2] > Close[BarShift+3])
{
Bar3Col = 3;
}
else if (Close[BarShift+2] < Close[BarShift+3]) Bar3Col = 8;
}
if (Bar3percent>=50 && Bar3percent<100)
{
if (Close[BarShift+2] > Close[BarShift+3])
{
Bar3Col = 4;
}
else if (Close[BarShift+2] < Close[BarShift+3]) Bar3Col = 7;
}
if (Bar3percent>=25 && Bar3percent<50)
{
if (Close[BarShift+2] > Close[BarShift+3])
{
Bar3Col = 5;
}
else if (Close[BarShift+2] < Close[BarShift+3]) Bar3Col = 6;
}
//--------------------------------------
if (Bar4percent==0 || Close[BarShift+3] == Close[BarShift+4])
{
Bar4Col = 12;
}
if (Bar4percent<25 && Bar4percent>0)
{
Bar4Col = 11;
}
if (Bar4percent>=400)
{
if (Close[BarShift+3] > Close[BarShift+4])
{
Bar4Col = 1;
}
else if (Close[BarShift+3] < Close[BarShift+4]) Bar4Col = 10;
}
if (Bar4percent>=200 && Bar4percent<400)
{
if (Close[BarShift+3] > Close[BarShift+4])
{
Bar4Col = 2;
}
else if (Close[BarShift+3] < Close[BarShift+4]) Bar4Col = 9;
}
if (Bar4percent>=100 && Bar4percent<200)
{
if (Close[BarShift+3] > Close[BarShift+4])
{
Bar4Col = 3;
}
else if (Close[BarShift+3] < Close[BarShift+4]) Bar4Col = 8;
}
if (Bar4percent>=50 && Bar4percent<100)
{
if (Close[BarShift+3] > Close[BarShift+4])
{
Bar4Col = 4;
}
else if (Close[BarShift+3] < Close[BarShift+4]) Bar4Col = 7;
}
if (Bar4percent>=25 && Bar4percent<50)
{
if (Close[BarShift+3] > Close[BarShift+4])
{
Bar4Col = 5;
}
else if (Close[BarShift+3] < Close[BarShift+4]) Bar4Col = 6;
}
//--------------------------------------
if (Bar5percent==0 || Close[BarShift+4] == Close[BarShift+5])
{
Bar5Col = 12;
}
if (Bar5percent<25 && Bar5percent>0)
{
Bar5Col = 11;
}
if (Bar5percent>=400)
{
if (Close[BarShift+4] > Close[BarShift+5])
{
Bar5Col = 1;
}
else if (Close[BarShift+4] < Close[BarShift+5]) Bar5Col = 10;
}
if (Bar5percent>=200 && Bar5percent<400)
{
if (Close[BarShift+4] > Close[BarShift+5])
{
Bar5Col = 2;
}
else if (Close[BarShift+4] < Close[BarShift+5]) Bar5Col = 9;
}
if (Bar5percent>=100 && Bar5percent<200)
{
if (Close[BarShift+4] > Close[BarShift+5])
{
Bar5Col = 3;
}
else if (Close[BarShift+4] < Close[BarShift+5]) Bar5Col = 8;
}
if (Bar5percent>=50 && Bar5percent<100)
{
if (Close[BarShift+4] > Close[BarShift+5])
{
Bar5Col = 4;
}
else if (Close[BarShift+4] < Close[BarShift+5]) Bar5Col = 7;
}
if (Bar5percent>=25 && Bar5percent<50)
{
if (Close[BarShift+4] > Close[BarShift+5])
{
Bar5Col = 5;
}
else if (Close[BarShift+4] < Close[BarShift+5]) Bar5Col = 6;
}
// Trend-O-Graph -------------
TGMA1M1=iMA(NULL,PERIOD_M1,MA1_Period,0,MA_Type,PRICE_CLOSE,BarShiftM1+0);
TGMA1M5=iMA(NULL,PERIOD_M5,MA1_Period,0,MA_Type,PRICE_CLOSE,BarShiftM5+0);
TGMA1M15=iMA(NULL,PERIOD_M15,MA1_Period,0,MA_Type,PRICE_CLOSE,BarShiftM15+0);
TGMA1M30=iMA(NULL,PERIOD_M30,MA1_Period,0,MA_Type,PRICE_CLOSE,BarShiftM30+0);
TGMA1H1=iMA(NULL,PERIOD_H1,MA1_Period,0,MA_Type,PRICE_CLOSE,BarShiftH1+0);
TGMA1H4=iMA(NULL,PERIOD_H4,MA1_Period,0,MA_Type,PRICE_CLOSE,BarShiftH4+0);
TGMA1D1=iMA(NULL,PERIOD_D1,MA1_Period,0,MA_Type,PRICE_CLOSE,BarShiftD1+0);
TGMA2M1=iMA(NULL,PERIOD_M1,MA2_Period,0,MA_Type,PRICE_CLOSE,BarShiftM1+0);
TGMA2M5=iMA(NULL,PERIOD_M5,MA2_Period,0,MA_Type,PRICE_CLOSE,BarShiftM5+0);
TGMA2M15=iMA(NULL,PERIOD_M15,MA2_Period,0,MA_Type,PRICE_CLOSE,BarShiftM15+0);
TGMA2M30=iMA(NULL,PERIOD_M30,MA2_Period,0,MA_Type,PRICE_CLOSE,BarShiftM30+0);
TGMA2H1=iMA(NULL,PERIOD_H1,MA2_Period,0,MA_Type,PRICE_CLOSE,BarShiftH1+0);
TGMA2H4=iMA(NULL,PERIOD_H4,MA2_Period,0,MA_Type,PRICE_CLOSE,BarShiftH4+0);
TGMA2D1=iMA(NULL,PERIOD_D1,MA2_Period,0,MA_Type,PRICE_CLOSE,BarShiftD1+0);
TGMA3M1=iMA(NULL,PERIOD_M1,MA3_Period,0,MA_Type,PRICE_CLOSE,BarShiftM1+0);
TGMA3M5=iMA(NULL,PERIOD_M5,MA3_Period,0,MA_Type,PRICE_CLOSE,BarShiftM5+0);
TGMA3M15=iMA(NULL,PERIOD_M15,MA3_Period,0,MA_Type,PRICE_CLOSE,BarShiftM15+0);
TGMA3M30=iMA(NULL,PERIOD_M30,MA3_Period,0,MA_Type,PRICE_CLOSE,BarShiftM30+0);
TGMA3H1=iMA(NULL,PERIOD_H1,MA3_Period,0,MA_Type,PRICE_CLOSE,BarShiftH1+0);
TGMA3H4=iMA(NULL,PERIOD_H4,MA3_Period,0,MA_Type,PRICE_CLOSE,BarShiftH4+0);
TGMA3D1=iMA(NULL,PERIOD_D1,MA3_Period,0,MA_Type,PRICE_CLOSE,BarShiftD1+0);
TGMA4M1=iMA(NULL,PERIOD_M1,MA4_Period,0,MA_Type,PRICE_CLOSE,BarShiftM1+0);
TGMA4M5=iMA(NULL,PERIOD_M5,MA4_Period,0,MA_Type,PRICE_CLOSE,BarShiftM5+0);
TGMA4M15=iMA(NULL,PERIOD_M15,MA4_Period,0,MA_Type,PRICE_CLOSE,BarShiftM15+0);
TGMA4M30=iMA(NULL,PERIOD_M30,MA4_Period,0,MA_Type,PRICE_CLOSE,BarShiftM30+0);
TGMA4H1=iMA(NULL,PERIOD_H1,MA4_Period,0,MA_Type,PRICE_CLOSE,BarShiftH1+0);
TGMA4H4=iMA(NULL,PERIOD_H4,MA4_Period,0,MA_Type,PRICE_CLOSE,BarShiftH4+0);
TGMA4D1=iMA(NULL,PERIOD_D1,MA4_Period,0,MA_Type,PRICE_CLOSE,BarShiftD1+0);
TGMA5M1=iMA(NULL,PERIOD_M1,MA5_Period,0,MA_Type,PRICE_CLOSE,BarShiftM1+0);
TGMA5M5=iMA(NULL,PERIOD_M5,MA5_Period,0,MA_Type,PRICE_CLOSE,BarShiftM5+0);
TGMA5M15=iMA(NULL,PERIOD_M15,MA5_Period,0,MA_Type,PRICE_CLOSE,BarShiftM15+0);
TGMA5M30=iMA(NULL,PERIOD_M30,MA5_Period,0,MA_Type,PRICE_CLOSE,BarShiftM30+0);
TGMA5H1=iMA(NULL,PERIOD_H1,MA5_Period,0,MA_Type,PRICE_CLOSE,BarShiftH1+0);
TGMA5H4=iMA(NULL,PERIOD_H4,MA5_Period,0,MA_Type,PRICE_CLOSE,BarShiftH4+0);
TGMA5D1=iMA(NULL,PERIOD_D1,MA5_Period,0,MA_Type,PRICE_CLOSE,BarShiftD1+0);
TGMA6M1=iMA(NULL,PERIOD_M1,MA6_Period,0,MA_Type,PRICE_CLOSE,BarShiftM1+0);
TGMA6M5=iMA(NULL,PERIOD_M5,MA6_Period,0,MA_Type,PRICE_CLOSE,BarShiftM5+0);
TGMA6M15=iMA(NULL,PERIOD_M15,MA6_Period,0,MA_Type,PRICE_CLOSE,BarShiftM15+0);
TGMA6M30=iMA(NULL,PERIOD_M30,MA6_Period,0,MA_Type,PRICE_CLOSE,BarShiftM30+0);
TGMA6H1=iMA(NULL,PERIOD_H1,MA6_Period,0,MA_Type,PRICE_CLOSE,BarShiftH1+0);
TGMA6H4=iMA(NULL,PERIOD_H4,MA6_Period,0,MA_Type,PRICE_CLOSE,BarShiftH4+0);
TGMA6D1=iMA(NULL,PERIOD_D1,MA6_Period,0,MA_Type,PRICE_CLOSE,BarShiftD1+0);
TGMA7M1=iMA(NULL,PERIOD_M1,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftM1+0);
TGMA7M5=iMA(NULL,PERIOD_M5,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftM5+0);
TGMA7M15=iMA(NULL,PERIOD_M15,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftM15+0);
TGMA7M30=iMA(NULL,PERIOD_M30,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftM30+0);
TGMA7H1=iMA(NULL,PERIOD_H1,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftH1+0);
TGMA7H4=iMA(NULL,PERIOD_H4,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftH4+0);
TGMA7D1=iMA(NULL,PERIOD_D1,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftD1+0);
TGMA7M1prev=iMA(NULL,PERIOD_M1,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftM1+1);
TGMA7M5prev=iMA(NULL,PERIOD_M5,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftM5+1);
TGMA7M15prev=iMA(NULL,PERIOD_M15,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftM15+1);
TGMA7M30prev=iMA(NULL,PERIOD_M30,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftM30+1);
TGMA7H1prev=iMA(NULL,PERIOD_H1,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftH1+1);
TGMA7H4prev=iMA(NULL,PERIOD_H4,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftH4+1);
TGMA7D1prev=iMA(NULL,PERIOD_D1,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftD1+1);
TGMA1M1prev=iMA(NULL,PERIOD_M1,MA1_Period,0,MA_Type,PRICE_CLOSE,BarShiftM1+1);
TGMA1M5prev=iMA(NULL,PERIOD_M5,MA1_Period,0,MA_Type,PRICE_CLOSE,BarShiftM5+1);
TGMA1M15prev=iMA(NULL,PERIOD_M15,MA1_Period,0,MA_Type,PRICE_CLOSE,BarShiftM15+1);
TGMA1M30prev=iMA(NULL,PERIOD_M30,MA1_Period,0,MA_Type,PRICE_CLOSE,BarShiftM30+1);
TGMA1H1prev=iMA(NULL,PERIOD_H1,MA1_Period,0,MA_Type,PRICE_CLOSE,BarShiftH1+1);
TGMA1H4prev=iMA(NULL,PERIOD_H4,MA1_Period,0,MA_Type,PRICE_CLOSE,BarShiftH4+1);
TGMA1D1prev=iMA(NULL,PERIOD_D1,MA1_Period,0,MA_Type,PRICE_CLOSE,BarShiftD1+1);
TGMA2M1prev=iMA(NULL,PERIOD_M1,MA2_Period,0,MA_Type,PRICE_CLOSE,BarShiftM1+1);
TGMA2M5prev=iMA(NULL,PERIOD_M5,MA2_Period,0,MA_Type,PRICE_CLOSE,BarShiftM5+1);
TGMA2M15prev=iMA(NULL,PERIOD_M15,MA2_Period,0,MA_Type,PRICE_CLOSE,BarShiftM15+1);
TGMA2M30prev=iMA(NULL,PERIOD_M30,MA2_Period,0,MA_Type,PRICE_CLOSE,BarShiftM30+1);
TGMA2H1prev=iMA(NULL,PERIOD_H1,MA2_Period,0,MA_Type,PRICE_CLOSE,BarShiftH1+1);
TGMA2H4prev=iMA(NULL,PERIOD_H4,MA2_Period,0,MA_Type,PRICE_CLOSE,BarShiftH4+1);
TGMA2D1prev=iMA(NULL,PERIOD_D1,MA2_Period,0,MA_Type,PRICE_CLOSE,BarShiftD1+1);
TGMA3M1prev=iMA(NULL,PERIOD_M1,MA3_Period,0,MA_Type,PRICE_CLOSE,BarShiftM1+1);
TGMA3M5prev=iMA(NULL,PERIOD_M5,MA3_Period,0,MA_Type,PRICE_CLOSE,BarShiftM5+1);
TGMA3M15prev=iMA(NULL,PERIOD_M15,MA3_Period,0,MA_Type,PRICE_CLOSE,BarShiftM15+1);
TGMA3M30prev=iMA(NULL,PERIOD_M30,MA3_Period,0,MA_Type,PRICE_CLOSE,BarShiftM30+1);
TGMA3H1prev=iMA(NULL,PERIOD_H1,MA3_Period,0,MA_Type,PRICE_CLOSE,BarShiftH1+1);
TGMA3H4prev=iMA(NULL,PERIOD_H4,MA3_Period,0,MA_Type,PRICE_CLOSE,BarShiftH4+1);
TGMA3D1prev=iMA(NULL,PERIOD_D1,MA3_Period,0,MA_Type,PRICE_CLOSE,BarShiftD1+1);
TGMA4M1prev=iMA(NULL,PERIOD_M1,MA4_Period,0,MA_Type,PRICE_CLOSE,BarShiftM1+1);
TGMA4M5prev=iMA(NULL,PERIOD_M5,MA4_Period,0,MA_Type,PRICE_CLOSE,BarShiftM5+1);
TGMA4M15prev=iMA(NULL,PERIOD_M15,MA4_Period,0,MA_Type,PRICE_CLOSE,BarShiftM15+1);
TGMA4M30prev=iMA(NULL,PERIOD_M30,MA4_Period,0,MA_Type,PRICE_CLOSE,BarShiftM30+1);
TGMA4H1prev=iMA(NULL,PERIOD_H1,MA4_Period,0,MA_Type,PRICE_CLOSE,BarShiftH1+1);
TGMA4H4prev=iMA(NULL,PERIOD_H4,MA4_Period,0,MA_Type,PRICE_CLOSE,BarShiftH4+1);
TGMA4D1prev=iMA(NULL,PERIOD_D1,MA4_Period,0,MA_Type,PRICE_CLOSE,BarShiftD1+1);
TGMA5M1prev=iMA(NULL,PERIOD_M1,MA5_Period,0,MA_Type,PRICE_CLOSE,BarShiftM1+1);
TGMA5M5prev=iMA(NULL,PERIOD_M5,MA5_Period,0,MA_Type,PRICE_CLOSE,BarShiftM5+1);
TGMA5M15prev=iMA(NULL,PERIOD_M15,MA5_Period,0,MA_Type,PRICE_CLOSE,BarShiftM15+1);
TGMA5M30prev=iMA(NULL,PERIOD_M30,MA5_Period,0,MA_Type,PRICE_CLOSE,BarShiftM30+1);
TGMA5H1prev=iMA(NULL,PERIOD_H1,MA5_Period,0,MA_Type,PRICE_CLOSE,BarShiftH1+1);
TGMA5H4prev=iMA(NULL,PERIOD_H4,MA5_Period,0,MA_Type,PRICE_CLOSE,BarShiftH4+1);
TGMA5D1prev=iMA(NULL,PERIOD_D1,MA5_Period,0,MA_Type,PRICE_CLOSE,BarShiftD1+1);
TGMA6M1prev=iMA(NULL,PERIOD_M1,MA6_Period,0,MA_Type,PRICE_CLOSE,BarShiftM1+1);
TGMA6M5prev=iMA(NULL,PERIOD_M5,MA6_Period,0,MA_Type,PRICE_CLOSE,BarShiftM5+1);
TGMA6M15prev=iMA(NULL,PERIOD_M15,MA6_Period,0,MA_Type,PRICE_CLOSE,BarShiftM15+1);
TGMA6M30prev=iMA(NULL,PERIOD_M30,MA6_Period,0,MA_Type,PRICE_CLOSE,BarShiftM30+1);
TGMA6H1prev=iMA(NULL,PERIOD_H1,MA6_Period,0,MA_Type,PRICE_CLOSE,BarShiftH1+1);
TGMA6H4prev=iMA(NULL,PERIOD_H4,MA6_Period,0,MA_Type,PRICE_CLOSE,BarShiftH4+1);
TGMA6D1prev=iMA(NULL,PERIOD_D1,MA6_Period,0,MA_Type,PRICE_CLOSE,BarShiftD1+1);
TGMA7M1prev=iMA(NULL,PERIOD_M1,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftM1+1);
TGMA7M5prev=iMA(NULL,PERIOD_M5,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftM5+1);
TGMA7M15prev=iMA(NULL,PERIOD_M15,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftM15+1);
TGMA7M30prev=iMA(NULL,PERIOD_M30,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftM30+1);
TGMA7H1prev=iMA(NULL,PERIOD_H1,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftH1+1);
TGMA7H4prev=iMA(NULL,PERIOD_H4,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftH4+1);
TGMA7D1prev=iMA(NULL,PERIOD_D1,MA7_Period,0,MA_Type,PRICE_CLOSE,BarShiftD1+1);
if (TGMA1M1>TGMA1M1prev) {TGMA1M1Signal=1;} else TGMA1M1Signal=0;
if (TGMA1M5>TGMA1M5prev) {TGMA1M5Signal=1;} else TGMA1M5Signal=0;
if (TGMA1M15>TGMA1M15prev) {TGMA1M15Signal=1;} else TGMA1M15Signal=0;
if (TGMA1M30>TGMA1M30prev) {TGMA1M30Signal=1;} else TGMA1M30Signal=0;
if (TGMA1H1>TGMA1H1prev) {TGMA1H1Signal=1;} else TGMA1H1Signal=0;
if (TGMA1H4>TGMA1H4prev) {TGMA1H4Signal=1;} else TGMA1H4Signal=0;
if (TGMA1D1>TGMA1D1prev) {TGMA1D1Signal=1;} else TGMA1D1Signal=0;
if (TGMA2M1>TGMA2M1prev) {TGMA2M1Signal=1;} else TGMA2M1Signal=0;
if (TGMA2M5>TGMA2M5prev) {TGMA2M5Signal=1;} else TGMA2M5Signal=0;
if (TGMA2M15>TGMA2M15prev) {TGMA2M15Signal=1;} else TGMA2M15Signal=0;
if (TGMA2M30>TGMA2M30prev) {TGMA2M30Signal=1;} else TGMA2M30Signal=0;
if (TGMA2H1>TGMA2H1prev) {TGMA2H1Signal=1;} else TGMA2H1Signal=0;
if (TGMA2H4>TGMA2H4prev) {TGMA2H4Signal=1;} else TGMA2H4Signal=0;
if (TGMA2D1>TGMA2D1prev) {TGMA2D1Signal=1;} else TGMA2D1Signal=0;
if (TGMA3M1>TGMA3M1prev) {TGMA3M1Signal=1;} else TGMA3M1Signal=0;
if (TGMA3M5>TGMA3M5prev) {TGMA3M5Signal=1;} else TGMA3M5Signal=0;
if (TGMA3M15>TGMA3M15prev) {TGMA3M15Signal=1;} else TGMA3M15Signal=0;
if (TGMA3M30>TGMA3M30prev) {TGMA3M30Signal=1;} else TGMA3M30Signal=0;
if (TGMA3H1>TGMA3H1prev) {TGMA3H1Signal=1;} else TGMA3H1Signal=0;
if (TGMA3H4>TGMA3H4prev) {TGMA3H4Signal=1;} else TGMA3H4Signal=0;
if (TGMA3D1>TGMA3D1prev) {TGMA3D1Signal=1;} else TGMA3D1Signal=0;
if (TGMA4M1>TGMA4M1prev) {TGMA4M1Signal=1;} else TGMA4M1Signal=0;
if (TGMA4M5>TGMA4M5prev) {TGMA4M5Signal=1;} else TGMA4M5Signal=0;
if (TGMA4M15>TGMA4M15prev) {TGMA4M15Signal=1;} else TGMA4M15Signal=0;
if (TGMA4M30>TGMA4M30prev) {TGMA4M30Signal=1;} else TGMA4M30Signal=0;
if (TGMA4H1>TGMA4H1prev) {TGMA4H1Signal=1;} else TGMA4H1Signal=0;
if (TGMA4H4>TGMA4H4prev) {TGMA4H4Signal=1;} else TGMA4H4Signal=0;
if (TGMA4D1>TGMA4D1prev) {TGMA4D1Signal=1;} else TGMA4D1Signal=0;
if (TGMA5M1>TGMA5M1prev) {TGMA5M1Signal=1;} else TGMA5M1Signal=0;
if (TGMA5M5>TGMA5M5prev) {TGMA5M5Signal=1;} else TGMA5M5Signal=0;
if (TGMA5M15>TGMA5M15prev) {TGMA5M15Signal=1;} else TGMA5M15Signal=0;
if (TGMA5M30>TGMA5M30prev) {TGMA5M30Signal=1;} else TGMA5M30Signal=0;
if (TGMA5H1>TGMA5H1prev) {TGMA5H1Signal=1;} else TGMA5H1Signal=0;
if (TGMA5H4>TGMA5H4prev) {TGMA5H4Signal=1;} else TGMA5H4Signal=0;
if (TGMA5D1>TGMA5D1prev) {TGMA5D1Signal=1;} else TGMA5D1Signal=0;
if (TGMA6M1>TGMA6M1prev) {TGMA6M1Signal=1;} else TGMA6M1Signal=0;
if (TGMA6M5>TGMA6M5prev) {TGMA6M5Signal=1;} else TGMA6M5Signal=0;
if (TGMA6M15>TGMA6M15prev) {TGMA6M15Signal=1;} else TGMA6M15Signal=0;
if (TGMA6M30>TGMA6M30prev) {TGMA6M30Signal=1;} else TGMA6M30Signal=0;
if (TGMA6H1>TGMA6H1prev) {TGMA6H1Signal=1;} else TGMA6H1Signal=0;
if (TGMA6H4>TGMA6H4prev) {TGMA6H4Signal=1;} else TGMA6H4Signal=0;
if (TGMA6D1>TGMA6D1prev) {TGMA6D1Signal=1;} else TGMA6D1Signal=0;
if (TGMA7M1>TGMA7M1prev) {TGMA7M1Signal=1;} else TGMA7M1Signal=0;
if (TGMA7M5>TGMA7M5prev) {TGMA7M5Signal=1;} else TGMA7M5Signal=0;
if (TGMA7M15>TGMA7M15prev) {TGMA7M15Signal=1;} else TGMA7M15Signal=0;
if (TGMA7M30>TGMA7M30prev) {TGMA7M30Signal=1;} else TGMA7M30Signal=0;
if (TGMA7H1>TGMA7H1prev) {TGMA7H1Signal=1;} else TGMA7H1Signal=0;
if (TGMA7H4>TGMA7H4prev) {TGMA7H4Signal=1;} else TGMA7H4Signal=0;
if (TGMA7D1>TGMA7D1prev) {TGMA7D1Signal=1;} else TGMA7D1Signal=0;
// Overbought/Oversold Map -------------------------------
OBOSRSIM1=iRSI(NULL,PERIOD_M1,14,PRICE_CLOSE,BarShiftM1+0);
OBOSRSIM5=iRSI(NULL,PERIOD_M5,14,PRICE_CLOSE,BarShiftM5+0);
OBOSRSIM15=iRSI(NULL,PERIOD_M15,14,PRICE_CLOSE,BarShiftM15+0);
OBOSRSIM30=iRSI(NULL,PERIOD_M30,14,PRICE_CLOSE,BarShiftM30+0);
OBOSRSIH1=iRSI(NULL,PERIOD_H1,14,PRICE_CLOSE,BarShiftH1+0);
OBOSRSIH4=iRSI(NULL,PERIOD_H4,14,PRICE_CLOSE,BarShiftH4+0);
OBOSRSID1=iRSI(NULL,PERIOD_D1,14,PRICE_CLOSE,BarShiftD1+0);
OBOSRSIM1prev=iRSI(NULL,PERIOD_M1,14,PRICE_CLOSE,BarShiftM1+1);
OBOSRSIM5prev=iRSI(NULL,PERIOD_M5,14,PRICE_CLOSE,BarShiftM5+1);
OBOSRSIM15prev=iRSI(NULL,PERIOD_M15,14,PRICE_CLOSE,BarShiftM15+1);
OBOSRSIM30prev=iRSI(NULL,PERIOD_M30,14,PRICE_CLOSE,BarShiftM30+1);
OBOSRSIH1prev=iRSI(NULL,PERIOD_H1,14,PRICE_CLOSE,BarShiftH1+1);
OBOSRSIH4prev=iRSI(NULL,PERIOD_H4,14,PRICE_CLOSE,BarShiftH4+1);
OBOSRSID1prev=iRSI(NULL,PERIOD_D1,14,PRICE_CLOSE,BarShiftD1+1);
OBOSCCIM1=iCCI(NULL,PERIOD_M1,12,PRICE_CLOSE,BarShiftM1+0);
OBOSCCIM5=iCCI(NULL,PERIOD_M5,12,PRICE_CLOSE,BarShiftM5+0);
OBOSCCIM15=iCCI(NULL,PERIOD_M15,12,PRICE_CLOSE,BarShiftM15+0);
OBOSCCIM30=iCCI(NULL,PERIOD_M30,12,PRICE_CLOSE,BarShiftM30+0);
OBOSCCIH1=iCCI(NULL,PERIOD_H1,12,PRICE_CLOSE,BarShiftH1+0);
OBOSCCIH4=iCCI(NULL,PERIOD_H4,12,PRICE_CLOSE,BarShiftH4+0);
OBOSCCID1=iCCI(NULL,PERIOD_D1,12,PRICE_CLOSE,BarShiftD1+0);
OBOSCCIM1prev=iCCI(NULL,PERIOD_M1,12,PRICE_CLOSE,BarShiftM1+1);
OBOSCCIM5prev=iCCI(NULL,PERIOD_M5,12,PRICE_CLOSE,BarShiftM5+1);
OBOSCCIM15prev=iCCI(NULL,PERIOD_M15,12,PRICE_CLOSE,BarShiftM15+1);
OBOSCCIM30prev=iCCI(NULL,PERIOD_M30,12,PRICE_CLOSE,BarShiftM30+1);
OBOSCCIH1prev=iCCI(NULL,PERIOD_H1,12,PRICE_CLOSE,BarShiftH1+1);
OBOSCCIH4prev=iCCI(NULL,PERIOD_H4,12,PRICE_CLOSE,BarShiftH4+1);
OBOSCCID1prev=iCCI(NULL,PERIOD_D1,12,PRICE_CLOSE,BarShiftD1+1);
OBOSMFIM1=iMFI(NULL,PERIOD_M1,14,BarShiftM1+0);
OBOSMFIM5=iMFI(NULL,PERIOD_M5,14,BarShiftM5+0);
OBOSMFIM15=iMFI(NULL,PERIOD_M15,14,BarShiftM15+0);
OBOSMFIM30=iMFI(NULL,PERIOD_M30,14,BarShiftM30+0);
OBOSMFIH1=iMFI(NULL,PERIOD_H1,14,BarShiftH1+0);
OBOSMFIH4=iMFI(NULL,PERIOD_H4,14,BarShiftH4+0);
OBOSMFID1=iMFI(NULL,PERIOD_D1,14,BarShiftD1+0);
OBOSMFIM1prev=iMFI(NULL,PERIOD_M1,14,BarShiftM1+1);
OBOSMFIM5prev=iMFI(NULL,PERIOD_M5,14,BarShiftM5+1);
OBOSMFIM15prev=iMFI(NULL,PERIOD_M15,14,BarShiftM15+1);
OBOSMFIM30prev=iMFI(NULL,PERIOD_M30,14,BarShiftM30+1);
OBOSMFIH1prev=iMFI(NULL,PERIOD_H1,14,BarShiftH1+1);
OBOSMFIH4prev=iMFI(NULL,PERIOD_H4,14,BarShiftH4+1);
OBOSMFID1prev=iMFI(NULL,PERIOD_D1,14,BarShiftD1+1);
OBOSWPRM1=iWPR(NULL,PERIOD_M1,14,BarShiftM1+0);
OBOSWPRM5=iWPR(NULL,PERIOD_M5,14,BarShiftM5+0);
OBOSWPRM15=iWPR(NULL,PERIOD_M15,14,BarShiftM15+0);
OBOSWPRM30=iWPR(NULL,PERIOD_M30,14,BarShiftM30+0);
OBOSWPRH1=iWPR(NULL,PERIOD_H1,14,BarShiftH1+0);
OBOSWPRH4=iWPR(NULL,PERIOD_H4,14,BarShiftH4+0);
OBOSWPRD1=iWPR(NULL,PERIOD_D1,14,BarShiftD1+0);
OBOSWPRM1prev=iWPR(NULL,PERIOD_M1,14,BarShiftM1+1);
OBOSWPRM5prev=iWPR(NULL,PERIOD_M5,14,BarShiftM5+1);
OBOSWPRM15prev=iWPR(NULL,PERIOD_M15,14,BarShiftM15+1);
OBOSWPRM30prev=iWPR(NULL,PERIOD_M30,14,BarShiftM30+1);
OBOSWPRH1prev=iWPR(NULL,PERIOD_H1,14,BarShiftH1+1);
OBOSWPRH4prev=iWPR(NULL,PERIOD_H4,14,BarShiftH4+1);
OBOSWPRD1prev=iWPR(NULL,PERIOD_D1,14,BarShiftD1+1);
OBOSBBHighM1=iBands(NULL,PERIOD_M1,BollingerBand_Period,BollingerBand_Deviation,0,PRICE_CLOSE,MODE_UPPER,BarShiftM1+0);
OBOSBBHighM5=iBands(NULL,PERIOD_M5,BollingerBand_Period,BollingerBand_Deviation,0,PRICE_CLOSE,MODE_UPPER,BarShiftM5+0);
OBOSBBHighM15=iBands(NULL,PERIOD_M15,BollingerBand_Period,BollingerBand_Deviation,0,PRICE_CLOSE,MODE_UPPER,BarShiftM15+0);
OBOSBBHighM30=iBands(NULL,PERIOD_M30,BollingerBand_Period,BollingerBand_Deviation,0,PRICE_CLOSE,MODE_UPPER,BarShiftM30+0);
OBOSBBHighH1=iBands(NULL,PERIOD_H1,BollingerBand_Period,BollingerBand_Deviation,0,PRICE_CLOSE,MODE_UPPER,BarShiftH1+0);
OBOSBBHighH4=iBands(NULL,PERIOD_H4,BollingerBand_Period,BollingerBand_Deviation,0,PRICE_CLOSE,MODE_UPPER,BarShiftH4+0);
OBOSBBHighD1=iBands(NULL,PERIOD_D1,BollingerBand_Period,BollingerBand_Deviation,0,PRICE_CLOSE,MODE_UPPER,BarShiftD1+0);
OBOSBBLowM1=iBands(NULL,PERIOD_M1,BollingerBand_Period,BollingerBand_Deviation,0,PRICE_CLOSE,MODE_LOWER,BarShiftM1+0);
OBOSBBLowM5=iBands(NULL,PERIOD_M5,BollingerBand_Period,BollingerBand_Deviation,0,PRICE_CLOSE,MODE_LOWER,BarShiftM5+0);
OBOSBBLowM15=iBands(NULL,PERIOD_M15,BollingerBand_Period,BollingerBand_Deviation,0,PRICE_CLOSE,MODE_LOWER,BarShiftM15+0);
OBOSBBLowM30=iBands(NULL,PERIOD_M30,BollingerBand_Period,BollingerBand_Deviation,0,PRICE_CLOSE,MODE_LOWER,BarShiftM30+0);
OBOSBBLowH1=iBands(NULL,PERIOD_H1,BollingerBand_Period,BollingerBand_Deviation,0,PRICE_CLOSE,MODE_LOWER,BarShiftH1+0);
OBOSBBLowH4=iBands(NULL,PERIOD_H4,BollingerBand_Period,BollingerBand_Deviation,0,PRICE_CLOSE,MODE_LOWER,BarShiftH4+0);
OBOSBBLowD1=iBands(NULL,PERIOD_D1,BollingerBand_Period,BollingerBand_Deviation,0,PRICE_CLOSE,MODE_LOWER,BarShiftD1+0);
OBOSMACDM1=iMACD(NULL,PERIOD_M1,12,26,9,PRICE_CLOSE,MODE_MAIN,BarShiftM1+0);
OBOSMACDM5=iMACD(NULL,PERIOD_M5,12,26,9,PRICE_CLOSE,MODE_MAIN,BarShiftM5+0);
OBOSMACDM15=iMACD(NULL,PERIOD_M15,12,26,9,PRICE_CLOSE,MODE_MAIN,BarShiftM15+0);
OBOSMACDM30=iMACD(NULL,PERIOD_M30,12,26,9,PRICE_CLOSE,MODE_MAIN,BarShiftM30+0);
OBOSMACDH1=iMACD(NULL,PERIOD_H1,12,26,9,PRICE_CLOSE,MODE_MAIN,BarShiftH1+0);
OBOSMACDH4=iMACD(NULL,PERIOD_H4,12,26,9,PRICE_CLOSE,MODE_MAIN,BarShiftH4+0);
OBOSMACDD1=iMACD(NULL,PERIOD_D1,12,26,9,PRICE_CLOSE,MODE_MAIN,BarShiftD1+0);
OBOSMACDM1prev=iMACD(NULL,PERIOD_M1,12,26,9,PRICE_CLOSE,MODE_MAIN,BarShiftM1+1);
OBOSMACDM5prev=iMACD(NULL,PERIOD_M5,12,26,9,PRICE_CLOSE,MODE_MAIN,BarShiftM5+1);
OBOSMACDM15prev=iMACD(NULL,PERIOD_M15,12,26,9,PRICE_CLOSE,MODE_MAIN,BarShiftM15+1);
OBOSMACDM30prev=iMACD(NULL,PERIOD_M30,12,26,9,PRICE_CLOSE,MODE_MAIN,BarShiftM30+1);
OBOSMACDH1prev=iMACD(NULL,PERIOD_H1,12,26,9,PRICE_CLOSE,MODE_MAIN,BarShiftH1+1);
OBOSMACDH4prev=iMACD(NULL,PERIOD_H4,12,26,9,PRICE_CLOSE,MODE_MAIN,BarShiftH4+1);
OBOSMACDD1prev=iMACD(NULL,PERIOD_D1,12,26,9,PRICE_CLOSE,MODE_MAIN,BarShiftD1+1);
OBOSMACDM1Signal=iMACD(NULL,PERIOD_M1,12,26,9,PRICE_CLOSE,MODE_SIGNAL,BarShiftM1+0);
OBOSMACDM5Signal=iMACD(NULL,PERIOD_M5,12,26,9,PRICE_CLOSE,MODE_SIGNAL,BarShiftM5+0);
OBOSMACDM15Signal=iMACD(NULL,PERIOD_M15,12,26,9,PRICE_CLOSE,MODE_SIGNAL,BarShiftM15+0);
OBOSMACDM30Signal=iMACD(NULL,PERIOD_M30,12,26,9,PRICE_CLOSE,MODE_SIGNAL,BarShiftM30+0);
OBOSMACDH1Signal=iMACD(NULL,PERIOD_H1,12,26,9,PRICE_CLOSE,MODE_SIGNAL,BarShiftH1+0);
OBOSMACDH4Signal=iMACD(NULL,PERIOD_H4,12,26,9,PRICE_CLOSE,MODE_SIGNAL,BarShiftH4+0);
OBOSMACDD1Signal=iMACD(NULL,PERIOD_D1,12,26,9,PRICE_CLOSE,MODE_SIGNAL,BarShiftD1+0);
OBOSMACDM1Signalprev=iMACD(NULL,PERIOD_M1,12,26,9,PRICE_CLOSE,MODE_SIGNAL,BarShiftM1+1);
OBOSMACDM5Signalprev=iMACD(NULL,PERIOD_M5,12,26,9,PRICE_CLOSE,MODE_SIGNAL,BarShiftM5+1);
OBOSMACDM15Signalprev=iMACD(NULL,PERIOD_M15,12,26,9,PRICE_CLOSE,MODE_SIGNAL,BarShiftM15+1);
OBOSMACDM30Signalprev=iMACD(NULL,PERIOD_M30,12,26,9,PRICE_CLOSE,MODE_SIGNAL,BarShiftM30+1);
OBOSMACDH1Signalprev=iMACD(NULL,PERIOD_H1,12,26,9,PRICE_CLOSE,MODE_SIGNAL,BarShiftH1+1);
OBOSMACDH4Signalprev=iMACD(NULL,PERIOD_H4,12,26,9,PRICE_CLOSE,MODE_SIGNAL,BarShiftH4+1);
OBOSMACDD1Signalprev=iMACD(NULL,PERIOD_D1,12,26,9,PRICE_CLOSE,MODE_SIGNAL,BarShiftD1+1);
// + OBOS Stochs from StochGraph
if ((Close[BarShiftM1+0]>OBOSBBHighM1 && Close[BarShiftM1+0]>Close[BarShiftM1+1]) || (Close[BarShiftM1+0]<OBOSBBLowM1 && Close[BarShiftM1+0]<Close[BarShiftM1+1])) {OBOSBBM1Signal=1;}
if ((Close[BarShiftM5+0]>OBOSBBHighM5 && Close[BarShiftM5+0]>Close[BarShiftM5+1]) || (Close[BarShiftM5+0]<OBOSBBLowM5 && Close[BarShiftM5+0]<Close[BarShiftM5+1])) {OBOSBBM5Signal=1;}
if ((Close[BarShiftM15+0]>OBOSBBHighM15 && Close[BarShiftM15+0]>Close[BarShiftM15+1]) || (Close[BarShiftM15+0]<OBOSBBLowM15 && Close[BarShiftM15+0]<Close[BarShiftM15+1])) {OBOSBBM15Signal=1;}
if ((Close[BarShiftM30+0]>OBOSBBHighM30 && Close[BarShiftM30+0]>Close[BarShiftM30+1]) || (Close[BarShiftM30+0]<OBOSBBLowM30 && Close[BarShiftM30+0]<Close[BarShiftM30+1])) {OBOSBBM30Signal=1;}
if ((Close[BarShiftH1+0]>OBOSBBHighH1 && Close[BarShiftH1+0]>Close[BarShiftH1+1]) || (Close[BarShiftH1+0]<OBOSBBLowH1 && Close[BarShiftH1+0]<Close[BarShiftH1+1])) {OBOSBBH1Signal=1;}
if ((Close[BarShiftH4+0]>OBOSBBHighH4 && Close[BarShiftH4+0]>Close[BarShiftH4+1]) || (Close[BarShiftH4+0]<OBOSBBLowH4 && Close[BarShiftH4+0]<Close[BarShiftH4+1])) {OBOSBBH4Signal=1;}
if ((Close[BarShiftD1+0]>OBOSBBHighD1 && Close[BarShiftD1+0]>Close[BarShiftD1+1]) || (Close[BarShiftD1+0]<OBOSBBLowD1 && Close[BarShiftD1+0]<Close[BarShiftD1+1])) {OBOSBBD1Signal=1;}
if (Close[BarShiftM1+0]>OBOSBBHighM1 && Close[BarShiftM1+0]<Close[BarShiftM1+1]) {OBOSBBM1Signal=3;}
if (Close[BarShiftM5+0]>OBOSBBHighM5 && Close[BarShiftM5+0]<Close[BarShiftM5+1]) {OBOSBBM5Signal=3;}
if (Close[BarShiftM15+0]>OBOSBBHighM15 && Close[BarShiftM15+0]<Close[BarShiftM15+1]) {OBOSBBM15Signal=3;}
if (Close[BarShiftM30+0]>OBOSBBHighM30 && Close[BarShiftM30+0]<Close[BarShiftM30+1]) {OBOSBBM30Signal=3;}
if (Close[BarShiftH1+0]>OBOSBBHighH1 && Close[BarShiftH1+0]<Close[BarShiftH1+1]) {OBOSBBH1Signal=3;}
if (Close[BarShiftH4+0]>OBOSBBHighH4 && Close[BarShiftH4+0]<Close[BarShiftH4+1]) {OBOSBBH4Signal=3;}
if (Close[BarShiftD1+0]>OBOSBBHighD1 && Close[BarShiftD1+0]<Close[BarShiftD1+1]) {OBOSBBD1Signal=3;}
if (Close[BarShiftM1+0]<OBOSBBLowM1 && Close[BarShiftM1+0]>Close[BarShiftM1+1]) {OBOSBBM1Signal=2;}
if (Close[BarShiftM5+0]<OBOSBBLowM5 && Close[BarShiftM5+0]>Close[BarShiftM5+1]) {OBOSBBM5Signal=2;}
if (Close[BarShiftM15+0]<OBOSBBLowM15 && Close[BarShiftM15+0]>Close[BarShiftM15+1]) {OBOSBBM15Signal=2;}
if (Close[BarShiftM30+0]<OBOSBBLowM30 && Close[BarShiftM30+0]>Close[BarShiftM30+1]) {OBOSBBM30Signal=2;}
if (Close[BarShiftH1+0]<OBOSBBLowH1 && Close[BarShiftH1+0]>Close[BarShiftH1+1]) {OBOSBBH1Signal=2;}
if (Close[BarShiftH4+0]<OBOSBBLowH4 && Close[BarShiftH4+0]>Close[BarShiftH4+1]) {OBOSBBH4Signal=2;}
if (Close[BarShiftD1+0]<OBOSBBLowD1 && Close[BarShiftD1+0]>Close[BarShiftD1+1]) {OBOSBBD1Signal=2;}
// --------------------------------------------------------------------------------------
if ((OBOSRSIM1>=RelativeStrengthIndex_SELL && OBOSRSIM1>OBOSRSIM1prev) || (OBOSRSIM1<=RelativeStrengthIndex_BUY && OBOSRSIM1<OBOSRSIM1prev)) {OBOSRSIM1Signal=1;}
if ((OBOSRSIM5>=RelativeStrengthIndex_SELL && OBOSRSIM5>OBOSRSIM5prev) || (OBOSRSIM5<=RelativeStrengthIndex_BUY && OBOSRSIM5<OBOSRSIM5prev)) {OBOSRSIM5Signal=1;}
if ((OBOSRSIM15>=RelativeStrengthIndex_SELL && OBOSRSIM15>OBOSRSIM15prev) || (OBOSRSIM15<=RelativeStrengthIndex_BUY && OBOSRSIM15<OBOSRSIM15prev)) {OBOSRSIM15Signal=1;}
if ((OBOSRSIM30>=RelativeStrengthIndex_SELL && OBOSRSIM30>OBOSRSIM30prev) || (OBOSRSIM30<=RelativeStrengthIndex_BUY && OBOSRSIM30<OBOSRSIM30prev)) {OBOSRSIM30Signal=1;}
if ((OBOSRSIH1>=RelativeStrengthIndex_SELL && OBOSRSIH1>OBOSRSIH1prev) || (OBOSRSIH1<=RelativeStrengthIndex_BUY && OBOSRSIH1<OBOSRSIH1prev)) {OBOSRSIH1Signal=1;}
if ((OBOSRSIH4>=RelativeStrengthIndex_SELL && OBOSRSIH4>OBOSRSIH4prev) || (OBOSRSIH4<=RelativeStrengthIndex_BUY && OBOSRSIH4<OBOSRSIH4prev)) {OBOSRSIH4Signal=1;}
if ((OBOSRSID1>=RelativeStrengthIndex_SELL && OBOSRSID1>OBOSRSID1prev) || (OBOSRSID1<=RelativeStrengthIndex_BUY && OBOSRSID1<OBOSRSID1prev)) {OBOSRSID1Signal=1;}
if (OBOSRSIM1>=RelativeStrengthIndex_SELL && OBOSRSIM1<OBOSRSIM1prev) {OBOSRSIM1Signal=3;}
if (OBOSRSIM5>=RelativeStrengthIndex_SELL && OBOSRSIM5<OBOSRSIM5prev) {OBOSRSIM5Signal=3;}
if (OBOSRSIM15>=RelativeStrengthIndex_SELL && OBOSRSIM15<OBOSRSIM15prev) {OBOSRSIM15Signal=3;}
if (OBOSRSIM30>=RelativeStrengthIndex_SELL && OBOSRSIM30<OBOSRSIM30prev) {OBOSRSIM30Signal=3;}
if (OBOSRSIH1>=RelativeStrengthIndex_SELL && OBOSRSIH1<OBOSRSIH1prev) {OBOSRSIH1Signal=3;}
if (OBOSRSIH4>=RelativeStrengthIndex_SELL && OBOSRSIH4<OBOSRSIH4prev) {OBOSRSIH4Signal=3;}
if (OBOSRSID1>=RelativeStrengthIndex_SELL && OBOSRSID1<OBOSRSID1prev) {OBOSRSID1Signal=3;}
if (OBOSRSIM1<=RelativeStrengthIndex_BUY && OBOSRSIM1>OBOSRSIM1prev) {OBOSRSIM1Signal=2;}
if (OBOSRSIM5<=RelativeStrengthIndex_BUY && OBOSRSIM5>OBOSRSIM5prev) {OBOSRSIM5Signal=2;}
if (OBOSRSIM15<=RelativeStrengthIndex_BUY && OBOSRSIM15>OBOSRSIM15prev) {OBOSRSIM15Signal=2;}
if (OBOSRSIM30<=RelativeStrengthIndex_BUY && OBOSRSIM30>OBOSRSIM30prev) {OBOSRSIM30Signal=2;}
if (OBOSRSIH1<=RelativeStrengthIndex_BUY && OBOSRSIH1>OBOSRSIH1prev) {OBOSRSIH1Signal=2;}
if (OBOSRSIH4<=RelativeStrengthIndex_BUY && OBOSRSIH4>OBOSRSIH4prev) {OBOSRSIH4Signal=2;}
if (OBOSRSID1<=RelativeStrengthIndex_BUY && OBOSRSID1>OBOSRSID1prev) {OBOSRSID1Signal=2;}
// --------------------------------------------------------------------------------------
if ((OBOSCCIM1>=CommodityChannelIndex_SELL && OBOSCCIM1>OBOSCCIM1prev) || (OBOSCCIM1<=CommodityChannelIndex_BUY && OBOSCCIM1<OBOSCCIM1prev)) {OBOSCCIM1Signal=1;}
if ((OBOSCCIM5>=CommodityChannelIndex_SELL && OBOSCCIM5>OBOSCCIM5prev) || (OBOSCCIM5<=CommodityChannelIndex_BUY && OBOSCCIM5<OBOSCCIM5prev)) {OBOSCCIM5Signal=1;}
if ((OBOSCCIM15>=CommodityChannelIndex_SELL && OBOSCCIM15>OBOSCCIM15prev) || (OBOSCCIM15<=CommodityChannelIndex_BUY && OBOSCCIM15<OBOSCCIM15prev)) {OBOSCCIM15Signal=1;}
if ((OBOSCCIM30>=CommodityChannelIndex_SELL && OBOSCCIM30>OBOSCCIM30prev) || (OBOSCCIM30<=CommodityChannelIndex_BUY && OBOSCCIM30<OBOSCCIM30prev)) {OBOSCCIM30Signal=1;}
if ((OBOSCCIH1>=CommodityChannelIndex_SELL && OBOSCCIH1>OBOSCCIH1prev) || (OBOSCCIH1<=CommodityChannelIndex_BUY && OBOSCCIH1<OBOSCCIH1prev)) {OBOSCCIH1Signal=1;}
if ((OBOSCCIH4>=CommodityChannelIndex_SELL && OBOSCCIH4>OBOSCCIH4prev) || (OBOSCCIH4<=CommodityChannelIndex_BUY && OBOSCCIH4<OBOSCCIH4prev)) {OBOSCCIH4Signal=1;}
if ((OBOSCCID1>=CommodityChannelIndex_SELL && OBOSCCID1>OBOSCCID1prev) || (OBOSCCID1<=CommodityChannelIndex_BUY && OBOSCCID1<OBOSCCID1prev)) {OBOSCCID1Signal=1;}
if (OBOSCCIM1>=CommodityChannelIndex_SELL && OBOSCCIM1<OBOSCCIM1prev) {OBOSCCIM1Signal=3;}
if (OBOSCCIM5>=CommodityChannelIndex_SELL && OBOSCCIM5<OBOSCCIM5prev) {OBOSCCIM5Signal=3;}
if (OBOSCCIM15>=CommodityChannelIndex_SELL && OBOSCCIM15<OBOSCCIM15prev) {OBOSCCIM15Signal=3;}
if (OBOSCCIM30>=CommodityChannelIndex_SELL && OBOSCCIM30<OBOSCCIM30prev) {OBOSCCIM30Signal=3;}
if (OBOSCCIH1>=CommodityChannelIndex_SELL && OBOSCCIH1<OBOSCCIH1prev) {OBOSCCIH1Signal=3;}
if (OBOSCCIH4>=CommodityChannelIndex_SELL && OBOSCCIH4<OBOSCCIH4prev) {OBOSCCIH4Signal=3;}
if (OBOSCCID1>=CommodityChannelIndex_SELL && OBOSCCID1<OBOSCCID1prev) {OBOSCCID1Signal=3;}
if (OBOSCCIM1<=CommodityChannelIndex_BUY && OBOSCCIM1>OBOSCCIM1prev) {OBOSCCIM1Signal=2;}
if (OBOSCCIM5<=CommodityChannelIndex_BUY && OBOSCCIM5>OBOSCCIM5prev) {OBOSCCIM5Signal=2;}
if (OBOSCCIM15<=CommodityChannelIndex_BUY && OBOSCCIM15>OBOSCCIM15prev) {OBOSCCIM15Signal=2;}
if (OBOSCCIM30<=CommodityChannelIndex_BUY && OBOSCCIM30>OBOSCCIM30prev) {OBOSCCIM30Signal=2;}
if (OBOSCCIH1<=CommodityChannelIndex_BUY && OBOSCCIH1>OBOSCCIH1prev) {OBOSCCIH1Signal=2;}
if (OBOSCCIH4<=CommodityChannelIndex_BUY && OBOSCCIH4>OBOSCCIH4prev) {OBOSCCIH4Signal=2;}
if (OBOSCCID1<=CommodityChannelIndex_BUY && OBOSCCID1>OBOSCCID1prev) {OBOSCCID1Signal=2;}
// --------------------------------------------------------------------------------------
if ((OBOSMFIM1>=MoneyFlowIndex_SELL && OBOSMFIM1>OBOSMFIM1prev) || (OBOSMFIM1<=MoneyFlowIndex_BUY && OBOSMFIM1<OBOSMFIM1prev)) {OBOSMFIM1Signal=1;}
if ((OBOSMFIM5>=MoneyFlowIndex_SELL && OBOSMFIM5>OBOSMFIM5prev) || (OBOSMFIM5<=MoneyFlowIndex_BUY && OBOSMFIM5<OBOSMFIM5prev)) {OBOSMFIM5Signal=1;}
if ((OBOSMFIM15>=MoneyFlowIndex_SELL && OBOSMFIM15>OBOSMFIM15prev) || (OBOSMFIM15<=MoneyFlowIndex_BUY && OBOSMFIM15<OBOSMFIM15prev)) {OBOSMFIM15Signal=1;}
if ((OBOSMFIM30>=MoneyFlowIndex_SELL && OBOSMFIM30>OBOSMFIM30prev) || (OBOSMFIM30<=MoneyFlowIndex_BUY && OBOSMFIM30<OBOSMFIM30prev)) {OBOSMFIM30Signal=1;}
if ((OBOSMFIH1>=MoneyFlowIndex_SELL && OBOSMFIH1>OBOSMFIH1prev) || (OBOSMFIH1<=MoneyFlowIndex_BUY && OBOSMFIH1<OBOSMFIH1prev)) {OBOSMFIH1Signal=1;}
if ((OBOSMFIH4>=MoneyFlowIndex_SELL && OBOSMFIH4>OBOSMFIH4prev) || (OBOSMFIH4<=MoneyFlowIndex_BUY && OBOSMFIH4<OBOSMFIH4prev)) {OBOSMFIH4Signal=1;}
if ((OBOSMFID1>=MoneyFlowIndex_SELL && OBOSMFID1>OBOSMFID1prev) || (OBOSMFID1<=MoneyFlowIndex_BUY && OBOSMFID1<OBOSMFID1prev)) {OBOSMFID1Signal=1;}
if (OBOSMFIM1>=MoneyFlowIndex_SELL && OBOSMFIM1<OBOSMFIM1prev) {OBOSMFIM1Signal=3;}
if (OBOSMFIM5>=MoneyFlowIndex_SELL && OBOSMFIM5<OBOSMFIM5prev) {OBOSMFIM5Signal=3;}
if (OBOSMFIM15>=MoneyFlowIndex_SELL && OBOSMFIM15<OBOSMFIM15prev) {OBOSMFIM15Signal=3;}
if (OBOSMFIM30>=MoneyFlowIndex_SELL && OBOSMFIM30<OBOSMFIM30prev) {OBOSMFIM30Signal=3;}
if (OBOSMFIH1>=MoneyFlowIndex_SELL && OBOSMFIH1<OBOSMFIH1prev) {OBOSMFIH1Signal=3;}
if (OBOSMFIH4>=MoneyFlowIndex_SELL && OBOSMFIH4<OBOSMFIH4prev) {OBOSMFIH4Signal=3;}
if (OBOSMFID1>=MoneyFlowIndex_SELL && OBOSMFID1<OBOSMFID1prev) {OBOSMFID1Signal=3;}
if (OBOSMFIM1<=MoneyFlowIndex_BUY && OBOSMFIM1>OBOSMFIM1prev) {OBOSMFIM1Signal=2;}
if (OBOSMFIM5<=MoneyFlowIndex_BUY && OBOSMFIM5>OBOSMFIM5prev) {OBOSMFIM5Signal=2;}
if (OBOSMFIM15<=MoneyFlowIndex_BUY && OBOSMFIM15>OBOSMFIM15prev) {OBOSMFIM15Signal=2;}
if (OBOSMFIM30<=MoneyFlowIndex_BUY && OBOSMFIM30>OBOSMFIM30prev) {OBOSMFIM30Signal=2;}
if (OBOSMFIH1<=MoneyFlowIndex_BUY && OBOSMFIH1>OBOSMFIH1prev) {OBOSMFIH1Signal=2;}
if (OBOSMFIH4<=MoneyFlowIndex_BUY && OBOSMFIH4>OBOSMFIH4prev) {OBOSMFIH4Signal=2;}
if (OBOSMFID1<=MoneyFlowIndex_BUY && OBOSMFID1>OBOSMFID1prev) {OBOSMFID1Signal=2;}
// --------------------------------------------------------------------------------------
if ((OBOSWPRM1>=WilliamsPercentRange_SELL && OBOSWPRM1>OBOSWPRM1prev) || (OBOSWPRM1<=WilliamsPercentRange_BUY && OBOSWPRM1<OBOSWPRM1prev)) {OBOSWPRM1Signal=1;}
if ((OBOSWPRM5>=WilliamsPercentRange_SELL && OBOSWPRM5>OBOSWPRM5prev) || (OBOSWPRM5<=WilliamsPercentRange_BUY && OBOSWPRM5<OBOSWPRM5prev)) {OBOSWPRM5Signal=1;}
if ((OBOSWPRM15>=WilliamsPercentRange_SELL && OBOSWPRM15>OBOSWPRM15prev) || (OBOSWPRM15<=WilliamsPercentRange_BUY && OBOSWPRM15<OBOSWPRM15prev)) {OBOSWPRM15Signal=1;}
if ((OBOSWPRM30>=WilliamsPercentRange_SELL && OBOSWPRM30>OBOSWPRM30prev) || (OBOSWPRM30<=WilliamsPercentRange_BUY && OBOSWPRM30<OBOSWPRM30prev)) {OBOSWPRM30Signal=1;}
if ((OBOSWPRH1>=WilliamsPercentRange_SELL && OBOSWPRH1>OBOSWPRH1prev) || (OBOSWPRH1<=WilliamsPercentRange_BUY && OBOSWPRH1<OBOSWPRH1prev)) {OBOSWPRH1Signal=1;}
if ((OBOSWPRH4>=WilliamsPercentRange_SELL && OBOSWPRH4>OBOSWPRH4prev) || (OBOSWPRH4<=WilliamsPercentRange_BUY && OBOSWPRH4<OBOSWPRH4prev)) {OBOSWPRH4Signal=1;}
if ((OBOSWPRD1>=WilliamsPercentRange_SELL && OBOSWPRD1>OBOSWPRD1prev) || (OBOSWPRD1<=WilliamsPercentRange_BUY && OBOSWPRD1<OBOSWPRD1prev)) {OBOSWPRD1Signal=1;}
if (OBOSWPRM1>=WilliamsPercentRange_SELL && OBOSWPRM1<OBOSWPRM1prev) {OBOSWPRM1Signal=3;}
if (OBOSWPRM5>=WilliamsPercentRange_SELL && OBOSWPRM5<OBOSWPRM5prev) {OBOSWPRM5Signal=3;}
if (OBOSWPRM15>=WilliamsPercentRange_SELL && OBOSWPRM15<OBOSWPRM15prev) {OBOSWPRM15Signal=3;}
if (OBOSWPRM30>=WilliamsPercentRange_SELL && OBOSWPRM30<OBOSWPRM30prev) {OBOSWPRM30Signal=3;}
if (OBOSWPRH1>=WilliamsPercentRange_SELL && OBOSWPRH1<OBOSWPRH1prev) {OBOSWPRH1Signal=3;}
if (OBOSWPRH4>=WilliamsPercentRange_SELL && OBOSWPRH4<OBOSWPRH4prev) {OBOSWPRH4Signal=3;}
if (OBOSWPRD1>=WilliamsPercentRange_SELL && OBOSWPRD1<OBOSWPRD1prev) {OBOSWPRD1Signal=3;}
if (OBOSWPRM1<=WilliamsPercentRange_BUY && OBOSWPRM1>OBOSWPRM1prev) {OBOSWPRM1Signal=2;}
if (OBOSWPRM5<=WilliamsPercentRange_BUY && OBOSWPRM5>OBOSWPRM5prev) {OBOSWPRM5Signal=2;}
if (OBOSWPRM15<=WilliamsPercentRange_BUY && OBOSWPRM15>OBOSWPRM15prev) {OBOSWPRM15Signal=2;}
if (OBOSWPRM30<=WilliamsPercentRange_BUY && OBOSWPRM30>OBOSWPRM30prev) {OBOSWPRM30Signal=2;}
if (OBOSWPRH1<=WilliamsPercentRange_BUY && OBOSWPRH1>OBOSWPRH1prev) {OBOSWPRH1Signal=2;}
if (OBOSWPRH4<=WilliamsPercentRange_BUY && OBOSWPRH4>OBOSWPRH4prev) {OBOSWPRH4Signal=2;}
if (OBOSWPRD1<=WilliamsPercentRange_BUY && OBOSWPRD1>OBOSWPRD1prev) {OBOSWPRD1Signal=2;}
// --------------------------------------------------------------------------------------
if ((M1stochK>=Stochastic_SELL && M1stochK>M1stochD) || (M1stochK<=Stochastic_BUY && M1stochK<M1stochD)) {OBOSSTOM1Signal=1;}
if ((M5stochK>=Stochastic_SELL && M5stochK>M5stochD) || (M5stochK<=Stochastic_BUY && M5stochK<M5stochD)) {OBOSSTOM5Signal=1;}
if ((M15stochK>=Stochastic_SELL && M15stochK>M15stochD) || (M15stochK<=Stochastic_BUY && M15stochK<M15stochD)) {OBOSSTOM15Signal=1;}
if ((M30stochK>=Stochastic_SELL && M30stochK>M30stochD) || (M30stochK<=Stochastic_BUY && M30stochK<M30stochD)) {OBOSSTOM30Signal=1;}
if ((H1stochK>=Stochastic_SELL && H1stochK>H1stochD) || (H1stochK<=Stochastic_BUY && H1stochK<H1stochD)) {OBOSSTOH1Signal=1;}
if ((H4stochK>=Stochastic_SELL && H4stochK>H4stochD) || (H4stochK<=Stochastic_BUY && H4stochK<H4stochD)) {OBOSSTOH4Signal=1;}
if ((D1stochK>=Stochastic_SELL && D1stochK>D1stochD) || (D1stochK<=Stochastic_BUY && D1stochK<D1stochD)) {OBOSSTOD1Signal=1;}
if (M1stochK>=Stochastic_SELL && M1stochK<M1stochKprev && M1stochK<=M1stochD) {OBOSSTOM1Signal=3;}
if (M5stochK>=Stochastic_SELL && M5stochK<M5stochKprev && M5stochK<=M5stochD) {OBOSSTOM5Signal=3;}
if (M15stochK>=Stochastic_SELL && M15stochK<M15stochKprev && M15stochK<=M15stochD) {OBOSSTOM15Signal=3;}
if (M30stochK>=Stochastic_SELL && M30stochK<M30stochKprev && M30stochK<=M30stochD) {OBOSSTOM30Signal=3;}
if (H1stochK>=Stochastic_SELL && H1stochK<H1stochKprev && H1stochK<=H1stochD) {OBOSSTOH1Signal=3;}
if (H4stochK>=Stochastic_SELL && H4stochK<H4stochKprev && H4stochK<=H4stochD) {OBOSSTOH4Signal=3;}
if (D1stochK>=Stochastic_SELL && D1stochK<D1stochKprev && D1stochK<=D1stochD) {OBOSSTOD1Signal=3;}
if (M1stochK<=Stochastic_BUY && M1stochK>M1stochKprev && M1stochK>=M1stochD) {OBOSSTOM1Signal=2;}
if (M5stochK<=Stochastic_BUY && M5stochK>M5stochKprev && M5stochK>=M5stochD) {OBOSSTOM5Signal=2;}
if (M15stochK<=Stochastic_BUY && M15stochK>M15stochKprev && M15stochK>=M15stochD) {OBOSSTOM15Signal=2;}
if (M30stochK<=Stochastic_BUY && M30stochK>M30stochKprev && M30stochK>=M30stochD) {OBOSSTOM30Signal=2;}
if (H1stochK<=Stochastic_BUY && H1stochK>H1stochKprev && H1stochK>=H1stochD) {OBOSSTOH1Signal=2;}
if (H4stochK<=Stochastic_BUY && H4stochK>H4stochKprev && H4stochK>=H4stochD) {OBOSSTOH4Signal=2;}
if (D1stochK<=Stochastic_BUY && D1stochK>D1stochKprev && D1stochK>=D1stochD) {OBOSSTOD1Signal=2;}
// --------------------------------------------------------------------------------------
if ((OBOSMACDM1>0 && OBOSMACDM1<OBOSMACDM1prev && OBOSMACDM1>OBOSMACDM1Signal) || (OBOSMACDM1<0 && OBOSMACDM1>OBOSMACDM1prev && OBOSMACDM1<OBOSMACDM1Signal)) {OBOSMACM1Signal=1;}
if ((OBOSMACDM5>0 && OBOSMACDM5<OBOSMACDM5prev && OBOSMACDM5>OBOSMACDM5Signal) || (OBOSMACDM5<0 && OBOSMACDM5>OBOSMACDM5prev && OBOSMACDM5<OBOSMACDM5Signal)) {OBOSMACM5Signal=1;}
if ((OBOSMACDM15>0 && OBOSMACDM15<OBOSMACDM15prev && OBOSMACDM15>OBOSMACDM15Signal) || (OBOSMACDM15<0 && OBOSMACDM15>OBOSMACDM15prev && OBOSMACDM15<OBOSMACDM15Signal)) {OBOSMACM15Signal=1;}
if ((OBOSMACDM30>0 && OBOSMACDM30<OBOSMACDM30prev && OBOSMACDM30>OBOSMACDM30Signal) || (OBOSMACDM30<0 && OBOSMACDM30>OBOSMACDM30prev && OBOSMACDM30<OBOSMACDM30Signal)) {OBOSMACM30Signal=1;}
if ((OBOSMACDH1>0 && OBOSMACDH1<OBOSMACDH1prev && OBOSMACDH1>OBOSMACDH1Signal) || (OBOSMACDH1<0 && OBOSMACDH1>OBOSMACDH1prev && OBOSMACDH1<OBOSMACDH1Signal)) {OBOSMACH1Signal=1;}
if ((OBOSMACDH4>0 && OBOSMACDH4<OBOSMACDH4prev && OBOSMACDH4>OBOSMACDH4Signal) || (OBOSMACDH4<0 && OBOSMACDH4>OBOSMACDH4prev && OBOSMACDH4<OBOSMACDH4Signal)) {OBOSMACH4Signal=1;}
if ((OBOSMACDD1>0 && OBOSMACDD1<OBOSMACDD1prev && OBOSMACDD1>OBOSMACDD1Signal) || (OBOSMACDD1<0 && OBOSMACDD1>OBOSMACDD1prev && OBOSMACDD1<OBOSMACDD1Signal)) {OBOSMACD1Signal=1;}
if (OBOSMACDM1>0 && OBOSMACDM1<OBOSMACDM1Signal && OBOSMACDM1prev>OBOSMACDM1Signalprev) {OBOSMACM1Signal=3;}
if (OBOSMACDM5>0 && OBOSMACDM5<OBOSMACDM5Signal && OBOSMACDM5prev>OBOSMACDM5Signalprev) {OBOSMACM5Signal=3;}
if (OBOSMACDM15>0 && OBOSMACDM15<OBOSMACDM15Signal && OBOSMACDM15prev>OBOSMACDM15Signalprev) {OBOSMACM15Signal=3;}
if (OBOSMACDM30>0 && OBOSMACDM30<OBOSMACDM30Signal && OBOSMACDM30prev>OBOSMACDM30Signalprev) {OBOSMACM30Signal=3;}
if (OBOSMACDH1>0 && OBOSMACDH1<OBOSMACDH1Signal && OBOSMACDH1prev>OBOSMACDH1Signalprev) {OBOSMACH1Signal=3;}
if (OBOSMACDH4>0 && OBOSMACDH4<OBOSMACDH4Signal && OBOSMACDH4prev>OBOSMACDH4Signalprev) {OBOSMACH4Signal=3;}
if (OBOSMACDD1>0 && OBOSMACDD1<OBOSMACDD1Signal && OBOSMACDD1prev>OBOSMACDD1Signalprev) {OBOSMACD1Signal=3;}
if (OBOSMACDM1<0 && OBOSMACDM1>OBOSMACDM1Signal && OBOSMACDM1prev<OBOSMACDM1Signalprev) {OBOSMACM1Signal=2;}
if (OBOSMACDM5<0 && OBOSMACDM5>OBOSMACDM5Signal && OBOSMACDM5prev<OBOSMACDM5Signalprev) {OBOSMACM5Signal=2;}
if (OBOSMACDM15<0 && OBOSMACDM15>OBOSMACDM15Signal && OBOSMACDM15prev<OBOSMACDM15Signalprev) {OBOSMACM15Signal=2;}
if (OBOSMACDM30<0 && OBOSMACDM30>OBOSMACDM30Signal && OBOSMACDM30prev<OBOSMACDM30Signalprev) {OBOSMACM30Signal=2;}
if (OBOSMACDH1<0 && OBOSMACDH1>OBOSMACDH1Signal && OBOSMACDH1prev<OBOSMACDH1Signalprev) {OBOSMACH1Signal=2;}
if (OBOSMACDH4<0 && OBOSMACDH4>OBOSMACDH4Signal && OBOSMACDH4prev<OBOSMACDH4Signalprev) {OBOSMACH4Signal=2;}
if (OBOSMACDD1<0 && OBOSMACDD1>OBOSMACDD1Signal && OBOSMACDD1prev<OBOSMACDD1Signalprev) {OBOSMACD1Signal=2;}
// Current Signals --------------------------------------------------------------------------------
if (Include_MAXover) {SignalBuy_MAXover = MAXoverSignal==1; SignalSell_MAXover = MAXoverSignal==0;}
if (Include_MACD) {SignalBuy_MACD = (MACD==3 || MACD==0); SignalSell_MACD = (MACD==1 || MACD==2);}
if (Include_PSAR) {SignalBuy_PSAR = PSARCurrent<Close[BarShift+0]; SignalSell_PSAR = PSARCurrent>Close[BarShift+0];}
if (Include_MA) {SignalBuy_MA = MACurrent>MAPrevious; SignalSell_MA = MACurrent<MAPrevious;}
if (Include_STOCH) {SignalBuy_STOCH = StochK>StochKprev; SignalSell_STOCH = StochK<StochKprev;}
if (Include_WPR) {SignalBuy_WPR = WPR>-50; SignalSell_WPR = WPR<-50;}
if (Include_PriceDirection) {SignalBuy_Price = Close[BarShift+0]>Close[BarShift+1]; SignalSell_Price = Close[BarShift+0]<Close[BarShift+1];}
// Multi Signals -------------
if (Include_M1_MA) {M1Buy = MAM1>MAM1prev; M1Sell = MAM1<MAM1prev;}
if (Include_M5_MA) {M5Buy = MAM5>MAM5prev; M5Sell = MAM5<MAM5prev;}
if (Include_M15_MA) {M15Buy = MAM15>MAM15prev; M15Sell = MAM15<MAM15prev;}
if (Include_M30_MA) {M30Buy = MAM30>MAM30prev; M30Sell = MAM30<MAM30prev;}
if (Include_H1_MA) {H1Buy = MAH1>MAH1prev; H1Sell = MAH1<MAH1prev;}
if (Include_H4_MA) {H4Buy = MAH4>MAH4prev; H4Sell = MAH4<MAH4prev;}
if (Include_D1_MA) {D1Buy = MAD1>MAD1prev; D1Sell = MAD1<MAD1prev;}
if (!Include_MAXover) {SignalBuy_MAXover = true; SignalSell_MAXover = true;}
if (!Include_MACD) {SignalBuy_MACD = true; SignalSell_MACD = true;}
if (!Include_PSAR) {SignalBuy_PSAR = true; SignalSell_PSAR = true;}
if (!Include_MA) {SignalBuy_MA = true; SignalSell_MA = true;}
if (!Include_STOCH) {SignalBuy_STOCH = true; SignalSell_STOCH = true;}
if (!Include_WPR) {SignalBuy_WPR = true; SignalSell_WPR = true;}
if (!Include_PriceDirection) {SignalBuy_Price = true; SignalSell_Price = true;}
if (!Include_M1_MA) {M1Buy = true; M1Sell = true;}
if (!Include_M5_MA) {M5Buy = true; M5Sell = true;}
if (!Include_M15_MA) {M15Buy = true; M15Sell = true;}
if (!Include_M30_MA) {M30Buy = true; M30Sell = true;}
if (!Include_H1_MA) {H1Buy = true; H1Sell = true;}
if (!Include_H4_MA) {H4Buy = true; H4Sell = true;}
if (!Include_D1_MA) {D1Buy = true; D1Sell = true;}
//Signal Sell ------------------------
if (SignalSell_MACD && SignalSell_MAXover && SignalSell_WPR && SignalSell_MA && SignalSell_STOCH && SignalSell_Price && SignalSell_PSAR && M1Sell && M5Sell && M15Sell && M30Sell && H1Sell && H4Sell && D1Sell)
{
Signal = 1;
}
//Signal Buy ------------------------
if (SignalBuy_MACD && SignalBuy_MAXover && SignalBuy_WPR && SignalBuy_MA && SignalBuy_STOCH && SignalBuy_Price && SignalBuy_PSAR && M1Buy && M5Buy && M15Buy && M30Buy && H1Buy && H4Buy && D1Buy)
{
Signal = 2;
}
//--------------------------------------
objectBlank();
paintM1(M1stochK);
paintM5(M5stochK);
paintM15(M15stochK);
paintM30(M30stochK);
paintH1(H1stochK);
paintH4(H4stochK);
paintD1(D1stochK);
paintLine();
paintMA_M1(trendM1);
paintMA_M5(trendM5);
paintMA_M15(trendM15);
paintMA_M30(trendM30);
paintMA_H1(trendH1);
paintMA_H4(trendH4);
paintMA_D1(trendD1);
paint2Line();
paintWPRUp(WPRValueUp);
paintWPRDown(WPRValueDown);
paintWPRValue(WPR);
paintSpread(Spread);
paintSpreadLines();
paintPSAR(PSAR);
paintMAXover(MAXoverSignal);
paintMACD(MACD);
paintBars();
paintBarValue1(Bar1percent);
paintBarValue2(Bar2percent);
paintBarValue3(Bar3percent);
paintBarValue4(Bar4percent);
paintBarValue5(Bar5percent);
paintBar1(Bar1Col);
paintBar2(Bar2Col);
paintBar3(Bar3Col);
paintBar4(Bar4Col);
paintBar5(Bar5Col);
paintBarReading(BarReading);
paintSignal(Signal);
if (DisplayTrendGraph && !DisplayCompact)
{
paintTrendGraph();
paintTGMA1M1(TGMA1M1Signal);
paintTGMA1M5(TGMA1M5Signal);
paintTGMA1M15(TGMA1M15Signal);
paintTGMA1M30(TGMA1M30Signal);
paintTGMA1H1(TGMA1H1Signal);
paintTGMA1H4(TGMA1H4Signal);
paintTGMA1D1(TGMA1D1Signal);
paintTGMA2M1(TGMA2M1Signal);
paintTGMA2M5(TGMA2M5Signal);
paintTGMA2M15(TGMA2M15Signal);
paintTGMA2M30(TGMA2M30Signal);
paintTGMA2H1(TGMA2H1Signal);
paintTGMA2H4(TGMA2H4Signal);
paintTGMA2D1(TGMA2D1Signal);
paintTGMA3M1(TGMA3M1Signal);
paintTGMA3M5(TGMA3M5Signal);
paintTGMA3M15(TGMA3M15Signal);
paintTGMA3M30(TGMA3M30Signal);
paintTGMA3H1(TGMA3H1Signal);
paintTGMA3H4(TGMA3H4Signal);
paintTGMA3D1(TGMA3D1Signal);
paintTGMA4M1(TGMA4M1Signal);
paintTGMA4M5(TGMA4M5Signal);
paintTGMA4M15(TGMA4M15Signal);
paintTGMA4M30(TGMA4M30Signal);
paintTGMA4H1(TGMA4H1Signal);
paintTGMA4H4(TGMA4H4Signal);
paintTGMA4D1(TGMA4D1Signal);
paintTGMA5M1(TGMA5M1Signal);
paintTGMA5M5(TGMA5M5Signal);
paintTGMA5M15(TGMA5M15Signal);
paintTGMA5M30(TGMA5M30Signal);
paintTGMA5H1(TGMA5H1Signal);
paintTGMA5H4(TGMA5H4Signal);
paintTGMA5D1(TGMA5D1Signal);
paintTGMA6M1(TGMA6M1Signal);
paintTGMA6M5(TGMA6M5Signal);
paintTGMA6M15(TGMA6M15Signal);
paintTGMA6M30(TGMA6M30Signal);
paintTGMA6H1(TGMA6H1Signal);
paintTGMA6H4(TGMA6H4Signal);
paintTGMA6D1(TGMA6D1Signal);
paintTGMA7M1(TGMA7M1Signal);
paintTGMA7M5(TGMA7M5Signal);
paintTGMA7M15(TGMA7M15Signal);
paintTGMA7M30(TGMA7M30Signal);
paintTGMA7H1(TGMA7H1Signal);
paintTGMA7H4(TGMA7H4Signal);
paintTGMA7D1(TGMA7D1Signal);
}
if (!DisplayTrendGraph && !DisplayCompact)
{
paintOBOSMap();
paintOBOSMACM1(OBOSMACM1Signal);
paintOBOSMACM5(OBOSMACM5Signal);
paintOBOSMACM15(OBOSMACM15Signal);
paintOBOSMACM30(OBOSMACM30Signal);
paintOBOSMACH1(OBOSMACH1Signal);
paintOBOSMACH4(OBOSMACH4Signal);
paintOBOSMACD1(OBOSMACD1Signal);
paintOBOSSTOM1(OBOSSTOM1Signal);
paintOBOSSTOM5(OBOSSTOM5Signal);
paintOBOSSTOM15(OBOSSTOM15Signal);
paintOBOSSTOM30(OBOSSTOM30Signal);
paintOBOSSTOH1(OBOSSTOH1Signal);
paintOBOSSTOH4(OBOSSTOH4Signal);
paintOBOSSTOD1(OBOSSTOD1Signal);
paintOBOSWPRM1(OBOSWPRM1Signal);
paintOBOSWPRM5(OBOSWPRM5Signal);
paintOBOSWPRM15(OBOSWPRM15Signal);
paintOBOSWPRM30(OBOSWPRM30Signal);
paintOBOSWPRH1(OBOSWPRH1Signal