CodeGenius V7.0.13 Neural Fuzzy of The Fuzziness: Jimmy Choronology In Da Middle… of Disco Party? – Hey! Jimmy In Da Club – Mere Zindagi Mere Hindustani = Jimmy… Jimmy… Jimmy… (Echoing), Aadja… Aadja… Aadja… (Echoing) – Zindagi Mera Gana…
I am running several tests on Instaforex demo accounts:
Please download Instaforex multiterminal or Instaforex MT4 trading software to view the results in real-time.
http://www.instaforex.com/downloads.php
Special Words of Thanx to Mr. John Bollinger for his very useful Bollinger Bands:
____________________________________________________________________
//+—————————————————————————————-+
//| CodeGenius V7.0.1 June 23 2013 .mq4 |
//| Copyright © 2013, MOHAMAD IZAHAM BIN MOHAMED YATIM |
//| http://www.qassimbaba.com |
//+—————————————————————————————-+
#property copyright “Copyright © 2013, MOHAMAD IZAHAM BIN MOHAMED YATIM”
#property link “http://www.qassimbaba.com”
#include <stdlib.mqh>
#include <stderror.mqh>
#include <WinUser32.mqh>
//********************************************************************************************************************
// Settings and Parameters
//********************************************************************************************************************
extern bool DynamicLotSize = false;
extern double EquityPercent = 1.0;
extern int MagicNumber = 313;
extern int Slippage = 3;
double TakeProfit = 0.00;
double StopLoss = 0.00;
extern double MaxSpread = 4;
extern int NumbersOfPairs = 8;
extern double MaxEquity = 13000000;
//********************************************************************************************************************
//********************************************************************************************************************
double MinAmount = 0;
double MarginLevel = 50;
int TradeUpPoint = 17;
double MinEquityStopLossPercentage = 30;
//********************************************************************************************************************
//********************************************************************************************************************
//—- Input Initialized Parameters
//********************************************************************************************************************
int x1 = 120;
int x2 = 172;
int x3 = 39;
int x4 = 172;
color pivotColor = Blue;
color pivotlevelColor = Blue;
int ChannelPeriod = 24;
int EMAPeriod = 120;
int StartEMAShift = 6;
int EndEMAShift = 0;
double AngleTreshold = 0.32;
string note1=”Change font colors automatically? True = Yes”;
bool Bid_Ask_Colors=True;
string note2=”Default Price Font Color”;
color FontColorPrice=Black;
string note3=”Font Size”;
int FontSizePrice=26;
string note4=”Font Type”;
string FontType=”Rockwell”;
int Corner=1;
color CandleTimeColor = Blue;
int XDistance=1;
int YDistance=5;
double Old_Price;
int signalcondition = 0;
int signalcondition2 = 0;
int CrossTime;
double CrossPrice;
string dbl2str;
string str_concat;
double UpperLine[];
double LowerLine[];
double MidLine[];
double BuyBuffer[];
double SellBuffer[];
double s1[];
bool BuySignal = FALSE;
bool SellSignal = FALSE;
bool BuySignal2 = FALSE;
bool SellSignal2 = FALSE;
bool CloseBuySignal = FALSE;
bool CloseSellSignal = FALSE;
//+——————————————————————+
//| External variables |
//+——————————————————————+
double Slw = 8;
double Pds = 13;
double Slwsignal = 9;
int Barcount = 2000;
//+——————————————————————+
//| Special Conversion Functions |
//+——————————————————————+
int LastTradeTime;
double ExtHistoBuffer[];
double ExtHistoBuffer2[];
bool BuyAlert=false, SellAlert=false;
bool BuyAlert2=false, SellAlert2=false;
bool BuyAlert3=false, SellAlert3=false;
void SetLoopCount(int loops)
{
}
void SetIndexValue(int shift, double value)
{
ExtHistoBuffer[shift] = value;
// Print (“ExtHistoBuffer :” ,value); // green
}
void SetIndexValue2(int shift, double value)
{
ExtHistoBuffer2[shift] = value;
// Print (“ExtHistoBuffer2 :” ,value); // green
}
double GetIndexValue(int shift)
{
return(ExtHistoBuffer[shift]);
}
double GetIndexValue2(int shift)
{
return(ExtHistoBuffer2[shift]);
}
// 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 LastTradeUpTicket48 = -1;
int LastTradeUpTicket53 = -1;
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);
//********************************************************************************************************************
/********************************************************************************************************************
double barvalue[1][6];
double close;
double high;
double low;
int start;
double fEndMA;
double fStartMA;
double fAngle;
int digits;
double k;
int m,s,l;
ArrayCopyRates(barvalue, Symbol(), PERIOD_D1);
if (DayOfWeek() == 1) {
if (TimeDayOfWeek(iTime(Symbol(), PERIOD_D1, 1)) == 5) {
close = barvalue[1][4];
high = barvalue[1][3];
low = barvalue[1][2];
} else {
for (int j = 5; j >= 0; j–) {
if (TimeDayOfWeek(iTime(Symbol(), PERIOD_D1, j)) == 5) {
close = barvalue[j][4];
high = barvalue[j][3];
low = barvalue[j][2];
}
}
}
} else {
close = barvalue[1][4];
high = barvalue[1][3];
low = barvalue[1][2];
}
double rangehl = high – low;
double pivot = (high + low + close) / 3.0;
double R3 = pivot + 1.0 * rangehl;
double R2 = pivot + 0.618 * rangehl;
double R1 = pivot + rangehl / 2.0;
double S1 = pivot – rangehl / 2.0;
double S2 = pivot – 0.618 * rangehl;
double S3 = pivot – 1.0 * rangehl;
int counted_indicators = IndicatorCounted();
if (Bars <= ChannelPeriod) return (0);
if (counted_indicators >= ChannelPeriod) start = Bars – counted_indicators – 1;
else start = Bars – ChannelPeriod – 1;
BuyBuffer[0] = 0;
SellBuffer[0] = 0;
for (int i = start; i >= 0; i–) {
double AA = 0;
double bb = 0;
double aa1 = 0;
double cnt1 = 0;
int shift = 0;
double cnt = 0;
double loopbegin = 0;
double loopbegin2 = 0;
double loopbegin3 = 0;
bool first = True;
double prevbars = 0;
double sum = 0;
double smconst = 0;
double smconst1 = 0;
double prev = 0;
double prev1 = 0;
double prev2 = 0;
double prev3 = 0;
double weight = 0;
double linear = 0;
double MAValue = 0;
double MAValue2 = 0;
double mavalue3 = 0;
string MAstring = “”;
double MyHigh = 0;
double MyLow = 0;
int counter = 0;
double Price = 0;
double Price1 = 0;
double tmpDevAA = 0;
SetLoopCount(0);
smconst = 2 / (1+Slw);
smconst1 = 2 / (1+Slwsignal);
loopbegin = loopbegin+1;
for(shift =Barcount;shift >=0 ;shift –)
{
prev = GetIndexValue2(shift+1);
// Yousky 15/05/2006 – Change to avoid Zero divide exception.
AA = 0;
// —
MAValue2 = smconst * (AA-prev) + prev;
SetIndexValue2(shift,MAValue2);
loopbegin = loopbegin-1;
}
loopbegin2 = loopbegin2+1;
for(shift =Barcount-Pds;shift >=0 ;shift –){
MyHigh = -999999;
MyLow = 99999999;
for(counter =shift;counter <=Pds + shift ;counter ++){
Price= GetIndexValue2(counter);
if( Price > MyHigh )
MyHigh = Price;
if( Pds <= 0 )
MyHigh = Price;
if( Price < MyLow )
MyLow = Price;
if( Pds <= 0 )
MyLow = Price;
}
prev1 = GetIndexValue(shift+1);
aa1=GetIndexValue2(shift);
// Yousky 15/05/2006 – Change to avoid Zero divide exception.
bb= 0;
if ((MyHigh-MyLow) != 0)
bb=100*(aa1-MyLow)/(MyHigh-MyLow);
// —
MAValue = smconst * (bb-prev1) + prev1;
SetIndexValue(shift,MAValue);
loopbegin2 = loopbegin2-1;
}
//Print (MAValue); // green
loopbegin3 = loopbegin3+1;
for(shift =Barcount;shift >=0 ;shift –){
prev2=GetIndexValue2(shift+1);
prev3=GetIndexValue(shift);
mavalue3= smconst1 * (prev3-prev2) +prev2;
SetIndexValue2(shift,mavalue3);
loopbegin3 = loopbegin3-1;
}
//+——————————————————————————————————————+
// BEGIN OF GENERALIZED DECISION FUNCTIONS
//+——————————————————————————————————————+
//+——————————————————————————————————————+
// END OF GENERALIZED DECISION FUNCTIONS
//+——————————————————————————————————————+
if (Bars < 10)
{
Comment(“Not enough bars”);
return (0);
}
if (Terminated == true)
{
Comment(“EA Terminated.”);
return (0);
}
OnEveryTick28();
}
void OnEveryTick28()
{
if (true == false && true) PipValue = 10;
if (true && (NDigits == 3 || NDigits == 5)) PipValue = 10;
SpreadFilter39();
PrintInfoToChart43();
PrintToLog44();
CheckEquity46();
IfOrderExists26();
IfOrderExists25();
SpreadFilter35();
CheckMarginLevel57();
CheckEquity55();
TechnicalAnalysis56();
TechnicalAnalysis72();
}
//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 PSAR()
{
double psar = (Close[0] – iSAR(NULL,0,0.02,0.2,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 MACDMAIN()
{
double macdmain = (iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0));
return (macdmain);
}
//
//+——————————————————————————————————————+
double MACDSIGNAL()
{
double macdsignal = (iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,0));
return (macdsignal);
}
//
//+——————————————————————————————————————+
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 SpreadFilter39()//SPREAD FILTER BUY ORDER
{
if (MarketInfo(Symbol(), MODE_SPREAD)/PipValue < MaxSpread)
{
IfOrderDoesNotExist38();
}
}
void IfOrderDoesNotExist38()
{
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)
{
TechnicalAnalysis2xOr37();
}
}
void TechnicalAnalysis2xOr37()// TECHNICAL ANALYSIS OPEN BUY ORDER
{
if ((0 > 0) || (0 > 0))
{
BuyOrder36();
}
}
void BuyOrder36()
{
//+——————————————————————————————————————+
// 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 IfGap”, MagicNumber, 0, Blue);
else
ticket = OrderSend(Symbol(), OP_BUY, LotSize, Ask, Slippage, SL, TP, “CodeGenius™ V7.0 IfGap”, 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()));
}
PrintToLog40();
}
else
{
Print(“OrderSend() error – “, ErrorDescription(GetLastError()));
}
}
void PrintToLog40()
{
Print(“Open Buy”);
}
void PrintInfoToChart43()
{
string temp = “Mohamad Izaham Bin Mohamed Yatim – Copyright © 1990 – 2013, CodeGenius™ (United Kingdom) Limited\nCodeGenius™ V7.0 : Executed : ” + Count13 + “, SPREAD : ” + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD)/PipValue, 2) +
+ “————————————————————————————————————————————————————————-\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() + “, CLOSE PRICE – PSAR (0.02,0.2) : ” + DoubleToStr(PSAR(), 4)+ “, CLOSE PRICE – EMA(50) : ” + DoubleToStr(CLOSE() – EMA50(), 4)+ “\n”
+ “STOCHASTIC (5,3,3) : ” + DoubleToStr(Stochastic(), 4)+ “, STOCHASTICMAIN(5,3,3) : ” + DoubleToStr(StochasticMain(), 4)+ “, STOCHASTICSIGNAL(5,3,3) : ” + DoubleToStr(StochasticSignal(), 4)+ “\n”
+ “MACD (12,26,9) : ” + DoubleToStr(MACD(), 4)+ “, MACDMAIN (12,26,9) : ” + DoubleToStr(MACDMAIN(), 4)+ “, MACDSIGNAL (12,26,9) : ” + DoubleToStr(MACDSIGNAL(), 4)+ “, FORCE (14) : ” + DoubleToStr(FORCE(), 4)+ “\n”
+ “DeMarker (14) : ” + DoubleToStr(DeMarker(), 4)+ “, OsMA (14) : ” + DoubleToStr(OsMA(), 4)+ “, Volume : ” + DoubleToStr(volume(), 0)+ “, MOMENTUM (14) : ” + DoubleToStr(MOM(), 4)+ “, Equity / Balance : ” + DoubleToStr(AccountEquity()/AccountBalance(), 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 PrintToLog44()
{
Print(“I am Thinking Honey…”);
}
void CheckEquity46()//CHECK EQUITY TO CLOSE ORDERS WHEN REACHES 13,000,000.00
{
if (AccountEquity() > MaxEquity)
{
CloseOrderIf41();
CloseOrderIf42();
}
}
void CloseOrderIf41()
{
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() > MinAmount)
{
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()));
}
}
PrintToLog29();
}
void PrintToLog29()
{
Print(“Close Sell “);
}
void CloseOrderIf42()
{
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() > MinAmount)
{
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()));
}
}
PrintToLog30();
}
void PrintToLog30()
{
Print(“Close Buy”);
}
void IfOrderExists26()
{
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)
{
TechnicalAnalysis24();
TechnicalAnalysis47();
}
}
void TechnicalAnalysis24()// TECHNICAL ANALYSIS CLOSE ORDER?
{
if (0 > 0)
{
CloseOrderIf41();
}
}
void TechnicalAnalysis47()// TECHNICAL ANALYSIS TRADE UP OPEN ORDER
{
if (0 > 0)
{
TradeUp48();
}
}
void TradeUp48()
{
//+——————————————————————————————————————+
// 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
//+——————————————————————————————————————+
bool exists = false;
if (LastTradeUpTicket48 != -1)
{
for (int j=OrdersTotal()-1; j >= 0; j–)
if (OrderSelect(j, SELECT_BY_POS, MODE_TRADES))
{
if (OrderTicket() == LastTradeUpTicket48)
{
exists = true;
}
}
else
{
Print(“OrderSelect() error – “, ErrorDescription(GetLastError()));
}
}
if (exists == false) LastTradeUpTicket48 = -1; // reset Ticket Id so trade-up would be possible
double takeprofit = 0;
double stoploss = 0;
for (int i=OrdersTotal()-1; i >= 0; i–)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber && LastTradeUpTicket48 == -1)
{
if (OrderType() == OP_BUY && Ask – OrderOpenPrice() > TradeUpPoint*PipValue*Point)
{
takeprofit = Ask+TakeProfit*PipValue*Point;
if (TakeProfit == 0) takeprofit = OrderTakeProfit();
stoploss = Ask-StopLoss*PipValue*Point;
if (StopLoss == 0) stoploss = OrderStopLoss();
LastTradeUpTicket48 = OrderTicket();
int ticket = -1;
if (true)
ticket = OrderSend(Symbol(), OP_BUY, LotSize, Ask, Slippage, 0, 0, “CodeGenius™ V7.0 IfGap”, MagicNumber, 0, White);
else
ticket = OrderSend(Symbol(), OP_BUY, LotSize, Ask, Slippage, stoploss, takeprofit, “CodeGenius™ V7.0 IfGap”, MagicNumber, 0, White);
if (ticket > -1)
{
if (true)
{
OrderSelect(ticket, SELECT_BY_TICKET);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), stoploss, takeprofit, 0, White);
if (ret == false)
Print(“OrderModify() error – “, ErrorDescription(GetLastError()));
}
}
}
if (OrderType() == OP_SELL && OrderOpenPrice() – Bid > TradeUpPoint*PipValue*Point)
{
takeprofit = Bid – TakeProfit*PipValue*Point;
if (TakeProfit == 0) takeprofit = OrderTakeProfit();
stoploss = Bid+StopLoss*PipValue*Point;
if (StopLoss == 0) stoploss = OrderStopLoss();
LastTradeUpTicket48 = OrderTicket();
int ticket2 = -1;
if (true)
ticket2 = OrderSend(Symbol(), OP_SELL, LotSize, Bid, Slippage, 0, 0, “CodeGenius™ V7.0 IfGap”, MagicNumber, 0, White);
else
ticket2 = OrderSend(Symbol(), OP_SELL, LotSize, Bid, Slippage, stoploss, takeprofit, “CodeGenius™ V7.0 IfGap”, MagicNumber, 0, White);
if (ticket2 > -1)
{
if (true)
{
OrderSelect(ticket2, SELECT_BY_TICKET);
bool ret4 = OrderModify(OrderTicket(), OrderOpenPrice(), stoploss, takeprofit, 0, White);
if (ret4 == false)
Print(“OrderModify() error – “, ErrorDescription(GetLastError()));
}
}
}
}
}
else
Print(“OrderSelect() error – “, ErrorDescription(GetLastError()));
}
void IfOrderExists25()
{
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)
{
TechnicalAnalysis27();
TechnicalAnalysis51();
}
}
void TechnicalAnalysis27()// TECHNICAL ANALYSIS CLOSE ORDER?
{
if (0 > 0)
{
CloseOrderIf42();
}
}
void TechnicalAnalysis51()// TECHNICAL ANALYSIS TRADE UP OPEN ORDER?
{
if (0 > 0)
{
TradeUp53();
}
}
void TradeUp53()
{
//+——————————————————————————————————————+
// 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
//+——————————————————————————————————————+
bool exists = false;
if (LastTradeUpTicket53 != -1)
{
for (int j=OrdersTotal()-1; j >= 0; j–)
if (OrderSelect(j, SELECT_BY_POS, MODE_TRADES))
{
if (OrderTicket() == LastTradeUpTicket53)
{
exists = true;
}
}
else
{
Print(“OrderSelect() error – “, ErrorDescription(GetLastError()));
}
}
if (exists == false) LastTradeUpTicket53 = -1; // reset Ticket Id so trade-up would be possible
double takeprofit = 0;
double stoploss = 0;
for (int i=OrdersTotal()-1; i >= 0; i–)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber && LastTradeUpTicket53 == -1)
{
if (OrderType() == OP_BUY && Ask – OrderOpenPrice() > TradeUpPoint*PipValue*Point)
{
takeprofit = Ask + TakeProfit*PipValue*Point;
if (TakeProfit == 0) takeprofit = OrderTakeProfit();
stoploss = Ask-StopLoss*PipValue*Point;
if (StopLoss == 0) stoploss = OrderStopLoss();
LastTradeUpTicket53 = OrderTicket();
int ticket = -1;
if (true)
ticket = OrderSend(Symbol(), OP_BUY, LotSize, Ask, Slippage, 0, 0, “CodeGenius™ V7.0 IfGap”, MagicNumber, 0, White);
else
ticket = OrderSend(Symbol(), OP_BUY, LotSize, Ask, Slippage, stoploss, takeprofit, “CodeGenius™ V7.0 IfGap”, MagicNumber, 0, White);
if (ticket > -1)
{
if (true)
{
OrderSelect(ticket, SELECT_BY_TICKET);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), stoploss, takeprofit, 0, White);
if (ret == false)
Print(“OrderModify() error – “, ErrorDescription(GetLastError()));
}
}
}
if (OrderType() == OP_SELL && OrderOpenPrice() – Bid > TradeUpPoint*PipValue*Point)
{
takeprofit = Bid – TakeProfit*PipValue*Point;
if (TakeProfit == 0) takeprofit = OrderTakeProfit();
stoploss = Bid+StopLoss*PipValue*Point;
if (StopLoss == 0) stoploss = OrderStopLoss();
LastTradeUpTicket53 = OrderTicket();
int ticket2 = -1;
if (true)
ticket2 = OrderSend(Symbol(), OP_SELL, LotSize, Bid, Slippage, 0, 0, “CodeGenius™ V7.0 IfGap”, MagicNumber, 0, White);
else
ticket2 = OrderSend(Symbol(), OP_SELL, LotSize, Bid, Slippage, stoploss, takeprofit, “CodeGenius™ V7.0 IfGap”, MagicNumber, 0, White);
if (ticket2 > -1)
{
if (true)
{
OrderSelect(ticket2, SELECT_BY_TICKET);
bool ret4 = OrderModify(OrderTicket(), OrderOpenPrice(), stoploss, takeprofit, 0, White);
if (ret4 == false)
Print(“OrderModify() error – “, ErrorDescription(GetLastError()));
}
}
}
}
}
else
Print(“OrderSelect() error – “, ErrorDescription(GetLastError()));
}
void SpreadFilter35()//SPREAD FILTER SELL ORDER
{
if (MarketInfo(Symbol(), MODE_SPREAD)/PipValue < MaxSpread)
{
IfOrderDoesNotExist34();
}
}
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)
{
TechnicalAnalysis2xOr33();
}
}
void TechnicalAnalysis2xOr33()// TECHNICAL ANALYSIS OPEN SELL ORDER
{
if ((0 > 0) || (0 > 0))
{
SellOrder32();
}
}
void SellOrder32()
{
//+——————————————————————————————————————+
// 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 IfGap”, MagicNumber, 0, Red);
else
ticket = OrderSend(Symbol(), OP_SELL, LotSize, Bid, Slippage, SL, TP, “CodeGenius™ V7.0 IfGap”, 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()));
}
PrintToLog31();
}
else
{
Print(“OrderSend() error – “, ErrorDescription(GetLastError()));
}
}
void PrintToLog31()
{
Print(“Open Sell”);
}
void CheckMarginLevel57()// TECHNICAL ANALYSIS CHECK MARGIN LEVEL
{
if ((AccountEquity() / AccountMargin()) * 100 > MarginLevel)
{
}
}
void CheckEquity55()// TECHNICAL ANALYSIS CHECK MINEQUITYSTOPLOSS
{
if (AccountEquity() < (MinEquityStopLossPercentage/100)*AccountBalance())
{
CloseOrder64();
CloseOrder63();
}
}
void CloseOrder64()
{
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()));
}
}
PrintToLog67();
}
void PrintToLog67()
{
Print(“Close All Orders”);
}
void CloseOrder63()
{
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()));
}
}
PrintToLog67();
}
void TechnicalAnalysis56()// TECHNICAL ANALYSIS CUSTOM 1
{
if (0 > 0)
{
CustomCode60();
}
}
void CustomCode60()
{
//——————————————
// Neural Fuzzy Algorithm 1 Source Codes
//——————————————
//
//
//
//
//
//
//
//——————————————
PrintToLog70();
}
void PrintToLog70()
{
Print(“Custom 1”);
}
void TechnicalAnalysis72()// TECHNICAL ANALYSIS CUSTOM 2
{
if (0 > 0)
{
CustomCode74();
}
}
void CustomCode74()
{
//——————————————
// Neural Fuzzy Algorithm 2 Source Codes
//——————————————
//
//
//
//
//
//
//
//——————————————
PrintToLog76();
}
void PrintToLog76()
{
Print(“Custom 2”);
}
int deinit()
{
if (false) ObjectsDeleteAll();
}
136560 12367Hi there! I could have sworn Ive been to this internet site before but soon after reading by way of some with the post I realized it is new to me. Anyhow, Im surely glad I identified it and Ill be book-marking and checking back often! 685202