Home > Case Law Studies > DECEMBER 12, 2012: 121212

DECEMBER 12, 2012: 121212

//+——————————————————————————————+
//|                                                                                  CODEGENIUS Version 7.mq4    |
//|               Copyright © 2013, MOHAMAD IZAHAM BIN MOHAMED YATIM    |
//|                                                                                    http://www.dotdotdot.com    |
//+——————————————————————————————+
#property copyright “Copyright © 2013, MOHAMAD IZAHAM BIN MOHAMED YATIM”
#property link      “http://www.dotdotdot.com”
#include <stdlib.mqh>
#include <stderror.mqh>
#include <WinUser32.mqh>

//+——————————————————————————————————————+
// Settings and Parameters
//+——————————————————————————————————————+
extern bool NeuralFuzzy = false;
extern bool DynamicLotSize = false;
extern bool DynamicLotSizeOnEquity = true;
extern double EquityPercent = 1.0;
extern double FixedLotSize = 0.01;
extern int MagicNumber = 313;
extern int Slippage = 4;
extern double TakeProfit = 888.00;
extern double StopLoss = 888.00;
extern double MaxSpread = 4;
extern double MaxEquity = 13000000;
//+——————————————————————————————————————+

//exported variables
double MaxAmountToCloseOrderIf = 500.00;
double MinProfitAmount = 0;

//+——————————————————————————————————————+
//    LOTSIZE BASED ON EQUITY
//+——————————————————————————————————————+
double LotSizeOnEquity;
//+——————————————————————————————————————+

//+——————————————————————————————————————+
//—- Input Initialized Neural Fuzzy Parameters
//+——————————————————————————————————————+
int x1 = 120;
int x2 = 172;
int x3 = 39;
int x4 = 172;
//+——————————————————————————————————————+

//+——————————————————————————————————————+
// Fibonacci Definitions
//+——————————————————————————————————————+
double   Retrace000 = 0.0;
double   Retrace236 = 0.0;
double   Retrace300 = 0.0;
double   Retrace382 = 0.0;
double   Retrace50 = 0.0;
double   Retrace618 = 0.0;
double   Retrace1000 = 0.0;
double   Extend618 = 0.0;
double   Extend1000 = 0.0;
double   Extend1382 = 0.0;
double   Extend1618 = 0.0;
double   Extend2618 = 0.0;
double   Extend4236 = 0.0;
datetime PrevTime = 0;
// buffers
double FibHighF[];
double FibLowF[];
double FibTrend[];
double FibRetrace000[];
double FibRetrace236[];
double FibRetrace300[];
double FibRetrace382[];
double FibRetrace50[];
double FibRetrace618[];
double FibRetrace1000[];
double FibExtend618[];
double FibExtend1000[];
double FibExtend1382[];
double FibExtend1618[];
double FibExtend2618[];
double FibExtend4236[];
//+——————————————————————————————————————+

// local variables
double PipValue=1;    // this variable is here to support 5-digit brokers
bool Terminated = false;
string LF = “\n”;  // use this in custom or utility blocks where you need line feeds
int NDigits = 4;   // used mostly for NormalizeDouble in Flex type blocks
int ObjCount = 0;  // count of all objects created on the chart, allows creation of objects with unique names
int current = 0;

int Count13 = 0;

int init()
{
NDigits = Digits;

if (false) ObjectsDeleteAll();      // clear the chart

Comment(“”);    // clear the chart
}

// Expert start
int start()
{

//+——————————————————————————————————————+
PlaySound(“tick.wav”);
//+——————————————————————————————————————+

//+——————————————————————————————————————+
double UsePoint;
int UseSlippage;
UsePoint = PipPoint(Symbol());
UseSlippage = GetSlippage(Symbol(),Slippage);
//+——————————————————————————————————————+

//+——————————————————————————————————————+
//    LOTSIZE BASED ON EQUITY
//+——————————————————————————————————————+
LotSizeOnEquity = (EquityPercent/100)*AccountEquity();
//+——————————————————————————————————————+

//+——————————————————————————————————————+
// FIBONACCI FUNCTIONS
//+——————————————————————————————————————+
datetime CurrTime = iTime(Symbol(),0,1);

if( CurrTime!=PrevTime )
{

int counted_bars = IndicatorCounted();

int bar = WindowFirstVisibleBar();
int shiftLowest = iLowest(NULL, 0, MODE_LOW, bar – 1, 1);
int shiftHighest = iHighest(NULL, 0, MODE_HIGH, bar – 1, 1);
double MyHighF = High[shiftHighest];
double MyLowF = Low[shiftLowest];
bool isSwingDown = shiftHighest > shiftLowest;

FibHighF[0] = MyHighF;
FibLowF[0] = MyLowF;

if (isSwingDown == true)// && Ask > MyLow + 5*PipPoints)
{
FibTrend[0] = 2;
Retrace000 = MyLowF;
FibRetrace000[0] = Retrace000;
Retrace236 = MyLowF + ((MyHighF – MyLowF)* 0.236);//lowest() + (range() * 0.236);
FibRetrace236[0] = Retrace236;
Retrace300 = MyLowF + ((MyHighF – MyLowF)* 0.300);
FibRetrace300[0] = Retrace300;
Retrace382 = MyLowF + ((MyHighF – MyLowF)* 0.382);
FibRetrace382[0] = Retrace382;
Retrace50 =  MyLowF + ((MyHighF – MyLowF)* 0.5);
FibRetrace50[0] = Retrace50;
Retrace618 = MyLowF + ((MyHighF – MyLowF)* 0.618);
FibRetrace618[0] = Retrace618;
Retrace1000 = MyHighF;
FibRetrace1000[0] = Retrace1000;
Extend618 = MyLowF – ((MyHighF – MyLowF)* 0.618);
FibExtend618[0] = Extend618;
Extend1000 = MyLowF – ((MyHighF – MyLowF)* 1.000);
FibExtend1000[0] = Extend1000;
Extend1382 = MyLowF – ((MyHighF – MyLowF)* 1.382);
FibExtend1382[0] = Extend1382;
Extend1618 = MyLowF – ((MyHighF – MyLowF)* 1.618);
FibExtend1618[0] = Extend1618;
Extend2618 = MyLowF – ((MyHighF – MyLowF)* 2.618);
FibExtend2618[0] = Extend2618;
Extend4236 = MyLowF – ((MyHighF – MyLowF)* 4.236);
FibExtend4236[0] = Extend4236;
}
else if (isSwingDown == false) // && Bid < MyHigh – 5*PipPoints)
{
FibTrend[0] = 1;
Retrace000 = MyHighF;
FibRetrace000[0] = Retrace000;
Retrace236 = MyHighF – ((MyHighF – MyLowF)* 0.236);//highest() – (range()* 0.236);
FibRetrace236[0] = Retrace236;
Retrace300 = MyHighF – ((MyHighF – MyLowF)* 0.300);
FibRetrace300[0] = Retrace300;
Retrace382 = MyHighF – ((MyHighF – MyLowF)* 0.382);
FibRetrace382[0] = Retrace382;
Retrace50 =  MyHighF – ((MyHighF – MyLowF)* 0.5);
FibRetrace50[0] = Retrace50;
Retrace618 = MyHighF – ((MyHighF – MyLowF)* 0.618);
FibRetrace618[0] = Retrace618;
Retrace1000 = MyLowF;
FibRetrace1000[0] = Retrace1000;
Extend618 = MyHighF + ((MyHighF – MyLowF)* 0.618);
FibExtend618[0] = Extend618;
Extend1000 = MyHighF +  ((MyHighF – MyLowF)* 1.000);
FibExtend1000[0] = Extend1000;
Extend1382 = MyHighF +  ((MyHighF – MyLowF)* 1.382);
FibExtend1382[0] = Extend1382;
Extend1618 = MyHighF +  ((MyHighF – MyLowF)* 1.618);
FibExtend1618[0] = Extend1618;
Extend2618 = MyHighF +  ((MyHighF – MyLowF)* 2.618);
FibExtend2618[0] = Extend2618;
Extend4236 = MyHighF +  ((MyHighF – MyLowF)* 4.236);
FibExtend4236[0] = Extend4236;
}
}
PrevTime = Time[0];

//+——————————————————————————————————————+

if (Bars < 10)
{
Comment(“Not enough bars”);
return (0);
}
if (Terminated == true)
{
Comment(“EA Terminated.”);
return (0);
}

OnEveryTick35();

}

void OnEveryTick35()
{
if (true == false && true) PipValue = 10;
if (true && (NDigits == 3 || NDigits == 5)) PipValue = 10;

PrintInfoToChart30();
IfOrderExists26();
IfOrderExists27();
IfOrderDoesNotExist33();
IfOrderDoesNotExist34();

}

//ANY TIMEFRAME
//+——————————————————————————————————————+
//|                                                                                                                  |
//+——————————————————————————————————————+
double ACC()
{
double ACc = iAC(NULL, 0, 1);
return(ACc);
}
//+——————————————————————————————————————+

//+——————————————————————————————————————+
//|                                                                                                                  |
//+——————————————————————————————————————+
double RSI()
{
double rsi_sig = iRSI(NULL, 0, 14, PRICE_CLOSE, 0);
return(rsi_sig);
}
//+——————————————————————————————————————+

//+——————————————————————————————————————+
//|                                                                                                                  |
//+——————————————————————————————————————+
double CCI()
{
double CCI_SIG = iCCI(NULL, 0, 14, PRICE_CLOSE, 0);
return(CCI_SIG);
}
//+——————————————————————————————————————+
//|                                                                                                                  |
//+——————————————————————————————————————+
double WPR()
{
double WPR_SIG = iWPR(NULL, 0, 14, 0);
return(WPR_SIG);
}
//+——————————————————————————————————————+
//|                                                                                                                  |
//+——————————————————————————————————————+
double ATR()
{
double WPR_SIG = iATR(NULL, 0, 14, 0);
return(WPR_SIG);
}
//+——————————————————————————————————————+
//|  The EMA50 – a function                                                                                          |
//+——————————————————————————————————————+
double EMA50()
{
double EMA50CLOSEPRICE = iMA(NULL,0,50,0,MODE_SMMA,PRICE_CLOSE,0);
return(EMA50CLOSEPRICE);
}
//+——————————————————————————————————————+
//|  The Close Price – a function                                                                                    |
//+——————————————————————————————————————+
double CLOSE()
{
double CLOSEPRICE = double iClose(NULL, 0, 0);
return(CLOSEPRICE);
}
//+——————————————————————————————————————+

//+——————————————————————————————————————+
//|  The Open Price – a function                                                                                     |
//+——————————————————————————————————————+
double OPEN()
{
double OPENPRICE = double iOpen(NULL, 0, 0);
return(OPENPRICE);
}
//+——————————————————————————————————————+
//|                                                                                                                  |
//+——————————————————————————————————————+
double DeMarker()
{
double val=iDeMarker(NULL, 0, 14, 1);
return(val);
}
//+——————————————————————————————————————+

//+——————————————————————————————————————+
//|                                                                                                                  |
//+——————————————————————————————————————+
double ADX()
{
double adxer = iADX(NULL,0,14,PRICE_HIGH,MODE_MAIN,0) –
iADX(NULL,0,14,PRICE_HIGH,MODE_PLUSDI,0);
return(adxer);
}
//+——————————————————————————————————————+

//+——————————————————————————————————————+
//|                                                                                                                  |
//+——————————————————————————————————————+
double OsMA()
{
double Osama = (iOsMA(NULL,0,12,26,14,PRICE_OPEN,1)) –
(iOsMA(NULL,0,12,26,14,PRICE_OPEN,0));
return(Osama);
}
//+——————————————————————————————————————+

//+——————————————————————————————————————+
//|                                                                                                                  |
//+——————————————————————————————————————+
double FORCE()
{
double val2=(iForce(NULL, 0, 13,MODE_SMA,PRICE_CLOSE,0));
return(val2);
}
//+——————————————————————————————————————+

//+——————————————————————————————————————+
//|                                                                                                                  |
//+——————————————————————————————————————+
double MOM()
{
double MOMENT = (iMomentum(NULL,0,12,PRICE_CLOSE,0) –
iMomentum(NULL,0,20,PRICE_CLOSE,0));
return(MOMENT);
}
//+——————————————————————————————————————+
//|                                                                                                                  |
//+——————————————————————————————————————+
double volume()
{
int i = 0;
double val5 = (iVolume(Symbol(),0,i));
return(val5);
i++;
}
//+——————————————————————————————————————+
//
//+——————————————————————————————————————+
double Stochastic()
{
double Stoc = (iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_MAIN,0) –
iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_SIGNAL,0));
return(Stoc);
}
//+——————————————————————————————————————+
//
//+——————————————————————————————————————+
double Ichimoku()
{
double IchimokuTen = iIchimoku(NULL, 0, 9, 26, 52, MODE_TENKANSEN, 1);
return(IchimokuTen);
}
//+——————————————————————————————————————+
//
//+——————————————————————————————————————+
double SAR()
{
double psar = (iSAR(NULL,0,0.02,0.2,0) – Close[0]);
return(psar);
}
//+——————————————————————————————————————+
double MACD()
{
double macd = (iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0) –
iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,0));
return (macd);
}
//
//+——————————————————————————————————————+
double highest()
{
int bar = WindowFirstVisibleBar();
double val6 = High[iHighest(NULL,0,MODE_HIGH, bar-1, 1)];
return(val6);
}
//+——————————————————————————————————————+
//
//+——————————————————————————————————————+
double lowest()
{
int bar = WindowFirstVisibleBar();
double val7 = Low[iLowest(NULL,0,MODE_LOW, bar-1, 1)];
return(val7);
}
//+——————————————————————————————————————+
//
//+——————————————————————————————————————+
double range()
{
double ranger = MathAbs((highest() – lowest()));
return(ranger);
}
//+——————————————————————————————————————+

//+——————————————————————————————————————+
//|                                                                                                                  |
//+——————————————————————————————————————+
double ackohonen()
{
double w1 = x1 – 100.0;
double w2 = x2 – 100.0;
double w3 = x3 – 100.0;
double w4 = x4 – 100.0;
double a1 = iAC(Symbol(), 0, 0);
double a2 = iAC(Symbol(), 0, 7);
double a3 = iAC(Symbol(), 0, 14);
double a4 = iAC(Symbol(), 0, 21);
double ackohonensqrt = (w1 * a1 + w2 * a2 + w3 * a3 + w4 * a4);
return (ackohonensqrt);
}
//+——————————————————————————————————————+

//+——————————————————————————————————————+
//|                                                                                                                  |
//+——————————————————————————————————————+
double achebbian()
{
double w11 = x1 – 100.0;
double w12 = x2 – 100.0;
double w13 = x3 – 100.0;
double w14 = x4 – 100.0;
double a11 = iAC(Symbol(), 0, 0);
double a12 = iAC(Symbol(), 0, 7);
double a13 = iAC(Symbol(), 0, 14);
double a14 = iAC(Symbol(), 0, 21);
double achebbiansqrt = (w11 * a11 + w12 * a12 + w13 * a13 + w14 * a14);
double achebbiansqr = ((achebbiansqrt*achebbiansqrt)/2);
return (achebbiansqr);
}
//+——————————————————————————————————————+

//+——————————————————————————————————————+
//|                                                                                                                  |
//+——————————————————————————————————————+
double macdkohonen()
{
double wmacdk1 = x1 – 100.0;
double wmacdk2 = x2 – 100.0;
double wmacdk3 = x3 – 100.0;
double wmacdk4 = x4 – 100.0;
double amacdk1 = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0) – iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,0);
double amacdk2 = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,7) – iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,7);
double amacdk3 = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,14) – iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,14);
double amacdk4 = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,21) – iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,21);
double macdkohonensqrt = (wmacdk1 * amacdk1 + wmacdk2 * amacdk2 + wmacdk3 * amacdk3 + wmacdk4 * amacdk4);
return (macdkohonensqrt);
}
//+——————————————————————————————————————+

//+——————————————————————————————————————+
//|                                                                                                                  |
//+——————————————————————————————————————+
double macdhebbian()
{
double wmacdh11 = x1 – 100.0;
double wmacdh12 = x2 – 100.0;
double wmacdh13 = x3 – 100.0;
double wmacdh14 = x4 – 100.0;
double amacdh11 = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0) – iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,0);
double amacdh12 = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,7) – iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,7);
double amacdh13 = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,14) – iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,14);
double amacdh14 = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,21) – iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,21);
double macdhebbiansqrt = (wmacdh11 * amacdh11 + wmacdh12 * amacdh12 + wmacdh13 * amacdh13 + wmacdh14 * amacdh14);
double macdhebbiansqr = ((macdhebbiansqrt*macdhebbiansqrt)/2);
return (macdhebbiansqr);
}
//+——————————————————————————————————————+

//+——————————————————————————————————————+
//|                                                                                                                  |
//+——————————————————————————————————————+
double bearkohonen()
{
double wbek1 = x1 – 100.0;
double wbek2 = x2 – 100.0;
double wbek3 = x3 – 100.0;
double wbek4 = x4 – 100.0;
double abek1 = iBearsPower(NULL, 0, 13,PRICE_CLOSE,0);
double abek2 = iBearsPower(NULL, 0, 13,PRICE_CLOSE,7);
double abek3 = iBearsPower(NULL, 0, 13,PRICE_CLOSE,14);
double abek4 = iBearsPower(NULL, 0, 13,PRICE_CLOSE,21);
double bearkohonensqrt = (-1)*(wbek1 * abek1 + wbek2 * abek2 + wbek3 * abek3 + wbek4 * abek4);
return (bearkohonensqrt);
}
//+——————————————————————————————————————+

//+——————————————————————————————————————+
//|                                                                                                                  |
//+——————————————————————————————————————+
double bearhebbian()
{
double wbeh11 = x1 – 100.0;
double wbeh12 = x2 – 100.0;
double wbeh13 = x3 – 100.0;
double wbeh14 = x4 – 100.0;
double abeh11 = iBearsPower(NULL, 0, 13,PRICE_CLOSE,0);
double abeh12 = iBearsPower(NULL, 0, 13,PRICE_CLOSE,7);
double abeh13 = iBearsPower(NULL, 0, 13,PRICE_CLOSE,14);
double abeh14 = iBearsPower(NULL, 0, 13,PRICE_CLOSE,21);
double bearhebbiansqrt = (wbeh11 * abeh11 + wbeh12 * abeh12 + wbeh13 * abeh13 + wbeh14 * abeh14);
double bearhebbiansqr = ((bearhebbiansqrt*bearhebbiansqrt)/2);
return (bearhebbiansqr);
}
//+——————————————————————————————————————+

//+——————————————————————————————————————+
//|                                                                                                                  |
//+——————————————————————————————————————+
double bullkohonen()
{
double wbuk1 = x1 – 100.0;
double wbuk2 = x2 – 100.0;
double wbuk3 = x3 – 100.0;
double wbuk4 = x4 – 100.0;
double abuk1 = iBullsPower(NULL, 0, 13,PRICE_CLOSE,0);
double abuk2 = iBullsPower(NULL, 0, 13,PRICE_CLOSE,7);
double abuk3 = iBullsPower(NULL, 0, 13,PRICE_CLOSE,14);
double abuk4 = iBullsPower(NULL, 0, 13,PRICE_CLOSE,21);
double bullkohonensqrt = (wbuk1 * abuk1 + wbuk2 * abuk2 + abuk3 * abuk3 + wbuk4 * abuk4);
return (bullkohonensqrt);
}
//+——————————————————————————————————————+

//+——————————————————————————————————————+
//|                                                                                                                  |
//+——————————————————————————————————————+
double bullhebbian()
{
double wbuh11 = x1 – 100.0;
double wbuh12 = x2 – 100.0;
double wbuh13 = x3 – 100.0;
double wbuh14 = x4 – 100.0;
double abuh11 = iBullsPower(NULL, 0, 13,PRICE_CLOSE,0);
double abuh12 = iBullsPower(NULL, 0, 13,PRICE_CLOSE,7);
double abuh13 = iBullsPower(NULL, 0, 13,PRICE_CLOSE,14);
double abuh14 = iBullsPower(NULL, 0, 13,PRICE_CLOSE,21);
double bullhebbiansqrt = (wbuh11 * abuh11 + wbuh12 * abuh12 + wbuh13 * abuh13 + wbuh14 * abuh14);
double bullhebbiansqr = ((bullhebbiansqrt*bullhebbiansqrt)/2);
return (bullhebbiansqr);
}
//+——————————————————————————————————————+

//+——————————————————————————————————————+
//|  The Slippage Function and PipPoint                                                                              |
//+——————————————————————————————————————+
// Pip Point Function
double PipPoint(string Currency)
{
int CalcDigits = MarketInfo(Currency,MODE_DIGITS);
if(CalcDigits == 2 || CalcDigits == 3) double CalcPoint = 0.01;
else if(CalcDigits == 4 || CalcDigits == 5) CalcPoint = 0.0001;
return(CalcPoint);
}

// Get Slippage Function
int GetSlippage(string Currency, int SlippagePips)
{
int CalcDigits = MarketInfo(Currency,MODE_DIGITS);
if(CalcDigits == 2 || CalcDigits == 4) double CalcSlippage = SlippagePips;
else if(CalcDigits == 3 || CalcDigits == 5) CalcSlippage = SlippagePips * 10;
return(CalcSlippage);
}
//+——————————————————————————————————————+

//+——————————————————————————————————————+
void PrintInfoToChart30()
{
string temp = “CodeGenius™ V7.0 – Mohamad Izaham Bin Mohamed Yatim – Copyright © 1990 – 2013, CodeGenius™ (United Kingdom) Limited\nExecuted : ” + Count13 + “, SPREAD : ” + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD)/PipValue, 2)+ “, RECOMMENDED LotSize : ” + DoubleToStr(LotSizeOnEquity, 2) + “, HighestPoint : ” + Symbol() + “, LowestPoint : ” + Symbol() + “\n”
+ “————————————————————————————————————————————————————————-\n”
+ “TECHNICAL ANALYSES:\n”
+ “\n”
+ “RSI (14) : ” + DoubleToStr(RSI(), 4)+ “, CCI (14) : ” + DoubleToStr(CCI(), 4)+ “, WPR (14) : ” + DoubleToStr(WPR(), 4)+ “, ATR (14) : ” + DoubleToStr(ATR(), 4)+ “, ADX (14) : ” + DoubleToStr(ADX(), 4)+ “, AC ( ) : ” + DoubleToStr(ACC(), 4)+ “\n”
+ “EMA50 : ” + DoubleToStr(EMA50(), 4)+ “, MACD (12,26,9) : ” + DoubleToStr(MACD(), 4)+ “, OPEN PRICE : ” + DoubleToStr(OPEN(), 4)+ “, CLOSE PRICE : ” + DoubleToStr(CLOSE(), 4)+ “, CLOSE – OPEN : ” + DoubleToStr(CLOSE() – OPEN(), 4)+ “\n”
+ “MARKET STABILITY : ” + Symbol() + “, PSAR (0.02,0.2) – CLOSE PRICE : ” + DoubleToStr(SAR(), 4)+ “, CLOSE PRICE – EMA(50) : ” + DoubleToStr(CLOSE() – EMA50(), 4)+ “\n”
+ “ICHIMOKU (9,26,52) : ” + DoubleToStr(Ichimoku(), 4)+ “, STOCHASTIC (5,3,3) : ” + DoubleToStr(Stochastic(), 4)+ “, MOMENTUM (14) : ” + DoubleToStr(MOM(), 4)+ “, FORCE (14) : ” + DoubleToStr(FORCE(), 4)+ “\n”
+ “DeMARKER (14) : ” + DoubleToStr(DeMarker(), 4)+ “, OsMA (14) : ” + DoubleToStr(OsMA(), 4)+ “, Volume : ” + DoubleToStr(volume(), 0)+ “, RECOMMENDED LotSize : ” + DoubleToStr(LotSizeOnEquity, 2) + “\n”
+ “————————————————————————————————————————————————————————-\n”
+ “NEURAL FUZZY NETS AND CHAOS THEORETICAL ANALYSES:\n”
+ “\n”
+ “Node 01      AC Kohonen :    ” + DoubleToStr(ackohonen(), 4)+ ”   Node 05 BEAR Kohonen :     ” + DoubleToStr(bearkohonen(), 4)+ “\n”
+ “Node 02       AC Hebbian :    ” + DoubleToStr(achebbian(), 4)+ ”   Node 06 BEAR Hebbian :      ” + DoubleToStr(bearhebbian(), 4)+ “\n”
+ “Node 03 MACD Kohonen :    ” + DoubleToStr(macdkohonen(), 4)+ ”   Node 07 BULL Kohonen :      ” + DoubleToStr(bullkohonen(), 4)+ “\n”
+ “Node 04 MACD Hebbian :     ” + DoubleToStr(macdhebbian(), 4)+ ”   Node 08 BULL Hebbian :       ” + DoubleToStr(bullhebbian(), 4)+ “\n”
+ “————————————————————————————————————————————————————————-\n”
+ “FIBONACCI ANALYSES:\n”
+ “\n”
+ “Fibonacci 0.00 R %    : ” + DoubleToStr(Retrace000, 4)+ “, Fibonacci 23.6 R %  : ” + DoubleToStr(Retrace236, 4)+ “\n”
+ “Fibonacci 38.2 R %    : ” + DoubleToStr(Retrace382, 4)+ “, Fibonacci 50.0 R %  : ” + DoubleToStr(Retrace50, 4)+ “\n”
+ “Fibonacci 61.8 R %    : ” + DoubleToStr(Retrace618, 4)+ “, Fibonacci 100.0 R % : ” + DoubleToStr(Retrace1000, 4)+ “\n”
+ “Fibonacci 61.8.0 E %  : ” + DoubleToStr(Extend618, 4)+ “, Fibonacci 100.0 E % : ” + DoubleToStr(Extend1000, 4)+ “\n”
+ “Fibonacci 138.2 E %  : ” + DoubleToStr(Extend1382, 4)+ “, Fibonacci 161.8 E % : ” + DoubleToStr(Extend1618, 4)+ “\n”
+ “Fibonacci 261.8 E % : ” + DoubleToStr(Extend2618, 4)+ “, Fibonacci 423.6 E %  : ” + DoubleToStr(Extend4236, 4)+ “\n”
+ “Lowest Peak: ” + DoubleToStr(lowest(), 4)+ “, Highest Peak: ” + DoubleToStr(highest(), 4)+ “, Range: ” + DoubleToStr(range(), 4)+ “\n”
+ “————————————————————————————————————————————————————————-\n”
+ “ACCOUNT INFORMATIONS:\n”
+ “\n”
+ “Account Name:     ” + AccountName()+ “\n”
+ “Account Leverage:     ” + DoubleToStr(AccountLeverage(), 0)+ “\n”
+ “Account Balance:     ” + DoubleToStr(AccountBalance(), 2)+ “\n”
+ “Account Equity:     ” + DoubleToStr(AccountEquity(), 2)+ “\n”
+ “Free Margin:     ” + DoubleToStr(AccountFreeMargin(), 2)+ “\n”
+ “Used Margin:     ” + DoubleToStr(AccountMargin(), 2)+ “\n”
+ “Profit/Loss:      ” + DoubleToStr(AccountProfit(), 2)+ “\n”
+ “Floatings %:      ” + DoubleToStr(AccountProfit()/AccountBalance()*100, 2)+” %”+”\n”
+ “————————————————————————————————————————————————————————-\n”;
Comment(temp);
Count13++;

}
//+——————————————————————————————————————+

void IfOrderExists26()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i–)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
{
exists = true;
}
}
else
{
Print(“OrderSelect() error – “, ErrorDescription(GetLastError()));
}

if (exists)
{
CloseOrderIf37();
TechnicalAnalysis2xOr20();
CheckEquity21();
TechnicalAnalysis2xOr19();

}
}

void CloseOrderIf37()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber)
{
continue;
}
if (OrderProfit() > MaxAmountToCloseOrderIf)
{
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), Slippage, Red);
if (ret == false)
Print(“OrderClose() error – “, ErrorDescription(GetLastError()));
}
}

}

void TechnicalAnalysis2xOr20()//Technical Analysis UTK CLOSE BUY ORDER KALAU CUKUP SYARAT DAN ADA UNTUNG
{
if(PUT YOUR DECISION HERE)
{
CheckOpenOrders31();

}
}

void CheckOpenOrders31()
{
double profit = 0;
for (int i=OrdersTotal()-1; i >= 0; i–)
{
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (true || (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber))
{
profit += OrderProfit();
}
}
else
{
Print(“OrderSelect() error – “, ErrorDescription(GetLastError()));
}
}

if (profit > MinProfitAmount)
{
CloseOrder29();

}
}

void CloseOrder29()//CLOSE BUY ORDER COMMAND
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber)
{
continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), Slippage, Red);
if (ret == false)
Print(“OrderClose() error – “, ErrorDescription(GetLastError()));
}
}

}

void CheckEquity21()//Technical Analysis UTK CLOSE BUY ORDER KALAU MAXEQUITY TERCAPAI
{

if (AccountEquity() > MaxEquity)
{
CloseOrder29();

}
}

void TechnicalAnalysis2xOr19()//Technical Analysis UTK CLOSE BUY ORDER KALAU SELL ORDER DAH BUKA (EMERGENCY)
{
if(PUT YOUR DECISION HERE)
{
CloseOrder29();

}
}

void IfOrderExists27()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i–)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
{
exists = true;
}
}
else
{
Print(“OrderSelect() error – “, ErrorDescription(GetLastError()));
}

if (exists)
{
CloseOrderIf52();
CheckEquity46();
TechnicalAnalysis2xOr17();
TechnicalAnalysis2xOr7();

}
}

void CloseOrderIf52()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber)
{
continue;
}
if (OrderProfit() > MaxAmountToCloseOrderIf)
{
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), Slippage, Red);
if (ret == false)
Print(“OrderClose() error – “, ErrorDescription(GetLastError()));
}
}

}

void CheckEquity46()//Technical Analysis UTK CLOSE SELL ORDER KALAU MAXEQUITY TERCAPAI
{

if (AccountEquity() > MaxEquity)
{
CloseOrder42();

}
}

void CloseOrder42()//CLOSE SELL ORDER COMMAND
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber)
{
continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), Slippage, Red);
if (ret == false)
Print(“OrderClose() error – “, ErrorDescription(GetLastError()));
}
}

}

void TechnicalAnalysis2xOr17()//Technical Analysis UTK CLOSE SELL ORDER KALAU BUY ORDER DAH BUKA (EMERGENCY)
{
if(PUT YOUR DECISION HERE)
{
CloseOrder42();

}
}

void TechnicalAnalysis2xOr7()//Technical Analysis UTK CLOSE SELL ORDER KALAU CUKUP SYARAT DAN ADA UNTUNG
{
if(PUT YOUR DECISION HERE)
{
CheckOpenOrders36();

}
}

void CheckOpenOrders36()
{
double profit = 0;
for (int i=OrdersTotal()-1; i >= 0; i–)
{
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (true || (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber))
{
profit += OrderProfit();
}
}
else
{
Print(“OrderSelect() error – “, ErrorDescription(GetLastError()));
}
}

if (profit > MinProfitAmount)
{
CloseOrder42();

}
}

void IfOrderDoesNotExist33()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i–)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
{
exists = true;
}
}
else
{
Print(“OrderSelect() error – “, ErrorDescription(GetLastError()));
}

if (exists == false)
{
TechnicalAnalysis3xOr40();

}
}

void TechnicalAnalysis3xOr40()//Technical Analysis UTK OPEN BUY ORDER
{
if(PUT YOUR DECISION HERE)
{
SpreadFilter23();

}
}

void SpreadFilter23()//SPREAD FILTER SEBELUM OPEN BUY ORDER
{
if (MarketInfo(Symbol(), MODE_SPREAD)/PipValue < MaxSpread)
{
BuyOrder28();

}
}

void BuyOrder28()
{

//+——————————————————————————————————————+
// Begin of LotSize Calculation
//+——————————————————————————————————————+
if(DynamicLotSize == true)
{
double RiskAmount = AccountEquity() * (EquityPercent / 100);
double TickValue = MarketInfo(Symbol(),MODE_TICKVALUE);
if(Point == 0.001 || Point == 0.00001) TickValue *= 10;
double CalcLots = (RiskAmount / StopLoss) / TickValue;
double LotSize = CalcLots;
}
else LotSize = LotSizeOnEquity;

// Lot size verification
if(LotSize < MarketInfo(Symbol(),MODE_MINLOT))
{
LotSize = MarketInfo(Symbol(),MODE_MINLOT);
}
else if(LotSize > MarketInfo(Symbol(),MODE_MAXLOT))
{
LotSize = MarketInfo(Symbol(),MODE_MAXLOT);
}

if(MarketInfo(Symbol(),MODE_LOTSTEP) == 0.1)
{
LotSize = NormalizeDouble(LotSize,1);
}
else LotSize = NormalizeDouble(LotSize,2);
//+——————————————————————————————————————+
// End of LotSize Calculation
//+——————————————————————————————————————+

double SL = Ask – StopLoss*PipValue*Point;
if (StopLoss == 0) SL = 0;
double TP = Ask + TakeProfit*PipValue*Point;
if (TakeProfit == 0) TP = 0;
int ticket = -1;
if (true)
ticket = OrderSend(Symbol(), OP_BUY, LotSize, Ask, Slippage, 0, 0, “CodeGenius™ v7.0”, MagicNumber, 0, Blue);
else
ticket = OrderSend(Symbol(), OP_BUY, LotSize, Ask, Slippage, SL, TP, “CodeGenius™ v7.0”, MagicNumber, 0, Blue);
if (ticket > -1)
{
if (true)
{
OrderSelect(ticket, SELECT_BY_TICKET);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue);
if (ret == false)
Print(“OrderModify() error – “, ErrorDescription(GetLastError()));
}

}
else
{
Print(“OrderSend() error – “, ErrorDescription(GetLastError()));
}
}

void IfOrderDoesNotExist34()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i–)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
{
exists = true;
}
}
else
{
Print(“OrderSelect() error – “, ErrorDescription(GetLastError()));
}

if (exists == false)
{
TechnicalAnalysis3xOr22();

}
}

void TechnicalAnalysis3xOr22()//Technical Analysis UTK OPEN SELL ORDER
{
if(PUT YOUR DECISION HERE)
{
SpreadFilter14();

}
}

void SpreadFilter14()//SPREAD FILTER SEBELUM OPEN SELL ORDER
{
if (MarketInfo(Symbol(), MODE_SPREAD)/PipValue < MaxSpread)
{
SellOrder25();

}
}

void SellOrder25()
{

//+——————————————————————————————————————+
// Begin of LotSize Calculation
//+——————————————————————————————————————+
if(DynamicLotSize == true)
{
double RiskAmount = AccountEquity() * (EquityPercent / 100);
double TickValue = MarketInfo(Symbol(),MODE_TICKVALUE);
if(Point == 0.001 || Point == 0.00001) TickValue *= 10;
double CalcLots = (RiskAmount / StopLoss) / TickValue;
double LotSize = CalcLots;
}
else LotSize = LotSizeOnEquity;

// Lot size verification
if(LotSize < MarketInfo(Symbol(),MODE_MINLOT))
{
LotSize = MarketInfo(Symbol(),MODE_MINLOT);
}
else if(LotSize > MarketInfo(Symbol(),MODE_MAXLOT))
{
LotSize = MarketInfo(Symbol(),MODE_MAXLOT);
}

if(MarketInfo(Symbol(),MODE_LOTSTEP) == 0.1)
{
LotSize = NormalizeDouble(LotSize,1);
}
else LotSize = NormalizeDouble(LotSize,2);
//+——————————————————————————————————————+
// End of LotSize Calculation
//+——————————————————————————————————————+

double SL = Bid + StopLoss*PipValue*Point;
if (StopLoss == 0) SL = 0;
double TP = Bid – TakeProfit*PipValue*Point;
if (TakeProfit == 0) TP = 0;
int ticket = -1;
if (true)
ticket = OrderSend(Symbol(), OP_SELL, LotSize, Bid, Slippage, 0, 0, “CodeGenius™ v7.0”, MagicNumber, 0, Red);
else
ticket = OrderSend(Symbol(), OP_SELL, LotSize, Bid, Slippage, SL, TP, “CodeGenius™ v7.0”, MagicNumber, 0, Red);
if (ticket > -1)
{
if (true)
{
OrderSelect(ticket, SELECT_BY_TICKET);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Red);
if (ret == false)
Print(“OrderModify() error – “, ErrorDescription(GetLastError()));
}

}
else
{
Print(“OrderSend() error – “, ErrorDescription(GetLastError()));
}
}

int deinit()
{

if (false) ObjectsDeleteAll();

}

Categories: Case Law Studies
  1. No comments yet.
  1. March 23, 2014 at 3:48 am
    www.youtube.com/
  2. March 26, 2014 at 4:45 am
    commercial vehicles in missouri
  3. March 29, 2014 at 11:17 pm
    car sales
  4. April 1, 2014 at 2:48 am
    trucks kansas city missouri
  5. May 6, 2014 at 11:50 pm
    my dog has arthritis
  6. May 6, 2014 at 11:52 pm
    a forever recovery
  7. May 7, 2014 at 1:10 am
    seo españa
  8. May 7, 2014 at 2:56 am
    antioxidant
  9. May 7, 2014 at 3:00 am
    rehabilitation program
  10. May 7, 2014 at 3:16 am
    final expense insurance
  11. May 7, 2014 at 7:06 am
    drug addiction recovery statistics
  12. May 7, 2014 at 8:37 am
    2014 ford focus
  13. May 7, 2014 at 12:38 pm
    drug addiction recovery statistics
  14. May 7, 2014 at 3:16 pm
    a forever recovery rehab facility
  15. May 7, 2014 at 3:52 pm
    promotion
  16. May 7, 2014 at 4:22 pm
    prices
  17. May 7, 2014 at 4:43 pm
    a forever recovery blog
  18. May 7, 2014 at 5:04 pm
    final expenses life insurance
  19. May 7, 2014 at 8:38 pm
    creator a forever recovery
  20. May 7, 2014 at 10:58 pm
    suvs
  21. May 7, 2014 at 11:58 pm
    online life insurance
  22. May 8, 2014 at 1:00 am
    final expense insurance
  23. May 8, 2014 at 3:52 am
    website design
  24. May 8, 2014 at 4:04 am
    online advertising agency
  25. May 8, 2014 at 4:56 am
    a forever recovery blog
  26. May 8, 2014 at 5:19 am
    creator a forever recovery
  27. May 8, 2014 at 8:41 am
    seo company seo
  28. May 8, 2014 at 10:00 am
    drugs and alcohol
  29. May 8, 2014 at 11:16 am
    Lexi Capital review
  30. May 8, 2014 at 12:40 pm
    arthritis or joint pain
  31. May 8, 2014 at 6:17 pm
    seo perth consultants
  32. May 8, 2014 at 8:39 pm
    trucks
  33. May 8, 2014 at 10:50 pm
    seo solutions canada
  34. May 9, 2014 at 4:30 am
    glucosamine for dogs
  35. May 9, 2014 at 5:00 am
    aforeverrecovery.com
  36. May 9, 2014 at 10:40 am
    best life insurance
  37. May 9, 2014 at 3:30 pm
    link building
  38. May 9, 2014 at 3:52 pm
    web site optimization
  39. May 9, 2014 at 5:19 pm
    search engine optimization company
  40. May 10, 2014 at 12:44 am
    creator a forever recovery
  41. May 10, 2014 at 8:11 am
    seo mexico df
  42. May 10, 2014 at 2:43 pm
    posicionamiento en google
  43. May 11, 2014 at 12:23 am
    seo web design
  44. May 11, 2014 at 2:53 am
    forever recovery alcoholism detox
  45. May 11, 2014 at 1:23 pm
    variable universal life insurance
  46. May 11, 2014 at 3:19 pm
    forever recovery
  47. May 12, 2014 at 2:03 am
    affordable life insurance
  48. May 12, 2014 at 4:38 am
    http://perthseod.com/semantic-web/
  49. May 12, 2014 at 6:01 am
    alcoholism causes
  50. May 12, 2014 at 6:22 am
    nyc seo company
  51. May 12, 2014 at 8:58 am
    life insurance quote
  52. May 12, 2014 at 9:23 am
    reliance life insurance
  53. May 12, 2014 at 10:43 am
    how professional seo service improve search
  54. May 12, 2014 at 12:23 pm
    life insurance quotes
  55. May 12, 2014 at 2:00 pm
    experto en seo
  56. May 12, 2014 at 3:45 pm
    life insurance
  57. May 13, 2014 at 12:14 am
    link building
  58. May 13, 2014 at 12:16 am
    no medical life insurance
  59. May 13, 2014 at 2:33 am
    seo company
  60. May 13, 2014 at 10:41 am
    automated submission
  61. May 13, 2014 at 11:43 am
    web design services - the the answer to
  62. May 14, 2014 at 2:02 am
    seo companies
  63. May 14, 2014 at 8:49 am
    online business seo
  64. May 14, 2014 at 8:49 am
    que significa seo
  65. May 14, 2014 at 12:22 pm
    serviciosdeseo.net
  66. May 15, 2014 at 12:06 am
    united life insurance
  67. May 15, 2014 at 2:16 am
    quirk vw nh
  68. May 15, 2014 at 3:58 am
    affordable life insurance
  69. May 15, 2014 at 11:03 am
    Quirk VW
  70. May 15, 2014 at 3:24 pm
    Quirk VW
  71. May 15, 2014 at 5:19 pm
    what is term life insurance
  72. May 15, 2014 at 8:07 pm
    posicionarse en google
  73. May 16, 2014 at 4:23 am
    Cerame Kia
  74. May 16, 2014 at 6:13 am
    Jim Glover Chevrolet
  75. May 16, 2014 at 7:15 am
    www.youtube.com
  76. May 16, 2014 at 10:12 am
    Cerame Kia
  77. May 16, 2014 at 11:48 am
    http://www.youtube.com/watch?v=-rHhXwjB-sXo
  78. May 16, 2014 at 10:30 pm
    Jim Glover Chevrolet
  79. May 20, 2014 at 12:38 pm
    overtime lawyer san francisco
  80. May 21, 2014 at 9:45 pm
    california labor office
  81. May 24, 2014 at 7:40 pm
    wage and hour disputes
  82. July 9, 2014 at 7:47 pm
    Intelligent Design AC
  83. July 10, 2014 at 7:20 am
    Lauterbach Buick Newton Iowa
  84. July 14, 2014 at 1:41 am
    Heating and Cooling Tucson
  85. July 16, 2014 at 5:04 am
    baltimore county home inspection services
  86. September 11, 2014 at 9:01 pm
    gary null detox

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: