Quantina-Intelligence Forex Robot 2012_EDU

Quantina-Intelligence Forex Robot 2012_EDU

开心版 无广告 155

更新日期:2022-11-03 分类标签: 语言:中文 平台:没限制

18 人已下载 手机查看

Quantina-Intelligence Forex Robot 2012_EDU Quantina-Intelligence Forex Robot 2012_EDU

//=============================================================================================
//Educated by lptuyen at www.forexisbiz.com (FIB Forum)
//Profile: http://www.forexisbiz.com/member.php/11057-lptuyen?tab=aboutme#aboutme
//Email: [email protected]
//Another forum: lptuyen at WWI
//http://worldwide-invest.org/members/48543-lptuyen?tab=aboutme#aboutme
//=============================================================================================

/*#import "Quantina.dll"
int CheckLicenceKey(int a0);
string GetFtpPassword();
#import "wininet.dll"
int InternetOpenA(string a0, int a1, string a2, string a3, int a4);
int InternetConnectA(int a0, string a1, int a2, string a3, string a4, int a5, int a6, int a7);
bool FtpGetFileA(int a0, string a1, string a2, bool a3, int a4, int a5, int a6);
bool FtpSetCurrentDirectoryA(int a0, string a1);
int InternetCloseHandle(int a0);
#import "kernel32.dll"
int _lopen(string a0, int a1);
int _llseek(int a0, int a1, int a2);
int _lread(int a0, string a1, int a2);
int _lclose(int a0);
#import*/

extern string s1="== Basic Settings ==";
//extern bool ManualSettings = FALSE;
extern int StopLoss=290;
extern int TakeProfit=100;
extern int TrailingStop = 15;
extern int TrailingStep = 2;
extern int ReverseTP=10;
extern string s2="== Money Management ==";
extern double DepositMoneyGuaranteed=0.0;
extern double Lots= 0.1;
extern bool UseMM = FALSE;
extern double PercentageMM=15.0;
extern string s3="== For Developers Only ==";
extern double MACDOpenLevel=3.0;
extern double MACDCloseLevel= 2.0;
extern double MATrendPeriod = 24.0;
extern string s4="== Time Filters on Risk Time == ";
extern string UseTradingHours="Time Control ( 1 = True, 0 = False )";
extern int TimeControl = 0;
extern string TimeZone = "Adjust ServerTimeZone if Required";
extern int ServerTimeZone=2;
extern string TradingTimes="HourStopGMT > HourStartGMT";
extern int HourStartGMT= 6;
extern int HourStopGMT = 22;
extern string DontTradeFriday="Dont Trade After FridayFinalHourGMT";
extern bool UseFridayFinalTradeTime=TRUE;
extern int FridayFinalHourGMT=6;
extern string s5="== Extra Settings ==";
extern int SlipPage=3;
extern int MagicNumber=145420;
extern string TradeComment="Quantina Intelligence FX Robot 2012";
//extern int LicenseKey = 11703270;
int g_count_268=1;
double gd_272;
double g_price_280;
double g_price_288;
bool gi_unused_296=FALSE;
int gi_300;
int gi_304;
int gi_308 = 0;
int gi_312 = 1;
int gi_unused_316 = 3;
int gi_unused_320 = 80;
// 53BB9515C362D5BE7CC2D9AEB44F468A
void f0_3()
{
int order_total_0=OrdersTotal();
for(int pos_4= order_total_0-1; pos_4>= 0; pos_4--)
{
if(OrderSelect(pos_4,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol())
{
if(OrderMagicNumber()==MagicNumber)
{
if(OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), SlipPage);
if(OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), SlipPage);
}
}
}
}
}
// C11AD6AF168353941358BAC0A0E8953F
void f0_8()
{
if(Digits== 4 || Digits == 2) gd_272 =Point;
if(Digits==5 || Digits==3)
{
SlipPage=10*SlipPage;
gd_272=10.0*Point;
}
}
// 3EF451BB4852740EF08D77193A641370
double f0_2()
{
double ld_ret_0;
double maxlot_8;
double minlot_16;
double lotstep_24;
if(UseMM)
{
ld_ret_0=PercentageMM*AccountFreeMargin()/100000.0;
lotstep_24=MarketInfo(Symbol(),MODE_LOTSTEP);
maxlot_8=MarketInfo(Symbol(),MODE_MAXLOT);
minlot_16= MarketInfo(Symbol(),MODE_MINLOT);
ld_ret_0 = MathFloor(ld_ret_0/lotstep_24) * lotstep_24;
if(ld_ret_0 > maxlot_8) return (maxlot_8);
if(ld_ret_0 < minlot_16) return (minlot_16);
return (ld_ret_0);
}
return (Lots);
}
// 773E9ECACC0D186289BC481F1502B87E
void f0_5()
{
string ls_40;
string ls_0 = "";
string ls_8 = " ----------------------------------------\n";
string ls_16= "\n";
string ls_unused_24="";
double ld_32=f0_2();
f0_4();
if(f0_4()==1) ls_40="Analysing...";
else ls_40="Non-Trading Time";
ls_0 = "Quantina-Intelligence Robot updated" + ls_16;
ls_0 = ls_0 + ls_16;
ls_0 = ls_0 + "Magic Number " + DoubleToStr(MagicNumber, 0) + ls_16;
ls_0 = ls_0 + "StopLoss " + DoubleToStr(StopLoss, 0) + " | ";
ls_0 = ls_0 + "TakeProfit " + DoubleToStr(TakeProfit, 0) + " | ";
ls_0 = ls_0 + "TrailingStop " + DoubleToStr(TrailingStop, 0) + ls_16;
ls_0 = ls_0 + "Date: " + Month() + "-" + Day() + "-" + Year() + " Server Time: " + TimeToStr(TimeCurrent(), TIME_SECONDS) + ls_16;
ls_0 = ls_0 + "GMT Time: " + TimeToStr(TimeCurrent() + 3600 * (0 - ServerTimeZone), TIME_SECONDS) + ls_16;
ls_0 = ls_0 + "ServerTimeZone: " + ServerTimeZone + " (TimeZone)" + ls_16;
ls_0 = ls_0 + ls_8;
ls_0 = ls_0 + ls_40 + ls_16;
ls_0 = ls_0 + "Lot Size " + DoubleToStr(ld_32, 2) + ls_16;
Comment(ls_0);
}
// 55D944E611F4A30AD221B5882DC1B594
int f0_4()
{
int li_0 = HourStartGMT + ServerTimeZone;
int li_4 = HourStopGMT + ServerTimeZone;
if(li_0<0) li_0+=24;
if(li_0>=24) li_0-=24;
if(li_4>24) li_4-=24;
if(li_4<=0) li_4+=24;
if((UseFridayFinalTradeTime && Hour() >= FridayFinalHourGMT + ServerTimeZone && DayOfWeek() == 5) || DayOfWeek() == 0) return (0);
if((f0_0(li_0, li_4) != 1 && TimeControl == 1 && li_0 < li_4) || (f0_0(li_4, li_0) != 0 && TimeControl == 1 && li_0 > li_4) || TimeControl == 0) return (1);
return (0);
}
// 006831096379F0BAA8F58F345D95EE00
int f0_0(int ai_0,int ai_4)
{
if(Hour() >= ai_0 && Hour() < ai_4) return (0);
return (1);
}
// E37F0136AA3FFAF149B351F6A4C948E9
int init()
{
//bool li_0;
/*if (ManualSettings == FALSE)
{
li_0 = f0_7();
if (li_0) Print("New parameters uploaded succesfully");
else Print("Could not update new parameters");
Print("In init");
Print("StopLoss : ", StopLoss);
}*/
return (0);
}
// EA2B2676C28C0DB26D39331A336C6B92
int start()
{
int ticket_52;
/*if (CheckLicenceKey(AccountNumber()) != LicenseKey) {
Print("LicenseKey incorrect. Please update your license");
Comment("LicenseKey incorrect. Please update your license");
return (0);
}*/
if(AccountBalance()<DepositMoneyGuaranteed)
{
f0_3();
Print("Balance is below DepositMoneyGuaranteed. EA will shutdown");
return (0);
}
if(Bars<100)
{
Print("bars less than 100");
return (0);
}
/*if (TakeProfit < 10)
{
Print("TakeProfit less than 10");
return (0);
}*/
double imacd_0 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 0);
double imacd_8 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 1);
double imacd_16 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 0);
double imacd_24 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 1);
double ima_32 = iMA(NULL, 0, MATrendPeriod, 0, MODE_EMA, PRICE_CLOSE, 0);
double ima_40 = iMA(NULL, 0, MATrendPeriod, 0, MODE_EMA, PRICE_CLOSE, 1);
f0_8();
f0_5();
int order_total_56=OrdersTotal();
if(g_count_268<1)
{
if(AccountFreeMargin()<1000.0*Lots)
{
Print("You dont have enough money. Free Margin = ",AccountFreeMargin());
return (0);
}
if(imacd_0<0.0 && imacd_0>imacd_16 && imacd_8<imacd_24 && MathAbs(imacd_0)>MACDOpenLevel*gd_272 && ima_32>ima_40 && f0_4())
{
ticket_52=OrderSend(Symbol(),OP_BUY,f0_2(),Ask,SlipPage,0,0,TradeComment,MagicNumber,0,Green);
if(ticket_52>0)
{
if(OrderSelect(ticket_52,SELECT_BY_TICKET,MODE_TRADES))
{
Print("BUY order opened : ",OrderOpenPrice());
g_count_268++;
}
}
else Print("Error opening BUY order : ",GetLastError());
return (0);
}
if(!(imacd_0 > 0.0 && imacd_0 < imacd_16 && imacd_8 > imacd_24 && imacd_0 > MACDOpenLevel * gd_272 && ima_32 < ima_40 && f0_4())) return (0);
ticket_52=OrderSend(Symbol(),OP_SELL,f0_2(),Bid,SlipPage,0,0,TradeComment,MagicNumber,0,Red);
if(ticket_52>0)
{
if(OrderSelect(ticket_52,SELECT_BY_TICKET,MODE_TRADES))
{
Print("SELL order opened : ",OrderOpenPrice());
g_count_268++;
}
}
else Print("Error opening SELL order : ",GetLastError());
return (0);
return (0);
}
if(g_count_268>0)
{
g_count_268=0;
for(int pos_48=0; pos_48<order_total_56; pos_48++)
{
OrderSelect(pos_48,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)
{
if(OrderType()==OP_BUY)
{
g_count_268++;
if(Bid-OrderOpenPrice()>ReverseTP*gd_272 && imacd_0>0.0 && imacd_0<imacd_16 && imacd_8>imacd_24 && imacd_0>MACDCloseLevel*gd_272)
{
OrderClose(OrderTicket(),OrderLots(),Bid,SlipPage,Violet);
return (0);
}
if(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>gd_272*TrailingStop)
{
if(OrderStopLoss()<Bid-gd_272 *(TrailingStop+TrailingStep))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-gd_272*TrailingStop,OrderTakeProfit(),0,Green);
return (0);
}
}
}
if(OrderStopLoss()==0.0 && OrderTakeProfit()==0.0 && StopLoss>0 || TakeProfit>0)
{
g_price_280=OrderStopLoss();
if(StopLoss>0) g_price_280=OrderOpenPrice()-StopLoss*gd_272;
g_price_288=OrderTakeProfit();
if(TakeProfit>0) g_price_288=OrderOpenPrice()+TakeProfit*gd_272;
OrderModify(OrderTicket(),OrderOpenPrice(),g_price_280,g_price_288,0,Green);
return (0);
}
}
if(OrderType()==OP_SELL)
{
g_count_268++;
if(OrderOpenPrice()-Ask>ReverseTP*gd_272 && imacd_0<0.0 && imacd_0>imacd_16 && imacd_8<imacd_24 && MathAbs(imacd_0)>MACDCloseLevel*gd_272)
{
OrderClose(OrderTicket(),OrderLots(),Ask,SlipPage,Violet);
return (0);
}
if(TrailingStop>0)
{
if(OrderOpenPrice()-Ask>gd_272*TrailingStop)
{
if(OrderStopLoss()>Ask+gd_272 *(TrailingStop+TrailingStep) || OrderStopLoss()==0.0)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+gd_272*TrailingStop,OrderTakeProfit(),0,Red);
return (0);
}
}
}
if(OrderStopLoss()==0.0 && OrderTakeProfit()==0.0 && StopLoss>0 || TakeProfit>0)
{
g_price_280=OrderStopLoss();
if(StopLoss>0) g_price_280=OrderOpenPrice()+StopLoss*gd_272;
g_price_288=OrderTakeProfit();
if(TakeProfit>0) g_price_288=OrderOpenPrice()-TakeProfit*gd_272;
OrderModify(OrderTicket(),OrderOpenPrice(),g_price_280,g_price_288,0,Red);
return (0);
}
}
}
}
}
return (0);
}

// 1BBC94D06E1F0D3B9CFC87C094EBA75D
/*int f0_1(bool ai_0) {
string ls_4;
if (gi_300 == 0) {
ls_4 = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)";
gi_300 = InternetOpenA(ls_4, gi_308, "0", "0", 0);
gi_304 = InternetOpenA(ls_4, gi_312, "0", "0", 0);
}
if (ai_0) return (gi_304);
Print("InternetOpenA : ", gi_300);
return (gi_300);
}

// F7561946DCC5DDB53D72302D4E3196E0
int f0_9(string as_0, string as_8) {
int lia_unused_24[] = {1};
string ls_unused_28 = " ";
int li_16 = InternetConnectA(f0_1(0), "ftp.plexywall.com", 21, "[email protected]", GetFtpPassword(), 1, 0, 0);
Print("InternetConnect", li_16);
int li_20 = FtpSetCurrentDirectoryA(li_16, "settings1");
Print("Set directory : ", li_20);
li_20 = FtpGetFileA(li_16, as_0, as_8, as_8, 128, 2, 0);
Print("Closing URL web connection iResult : ", li_20);
li_20 = InternetCloseHandle(li_16);
if (li_20 == 0) return (0);
return (1);
}

// 9793E97D7800C4D457A5DDACF2871FBA
string f0_6(string as_0) {
int li_8 = _lopen(as_0, 0);
if (li_8 < 0) {
Print("Error opening file ", as_0);
return ("");
}
int li_12 = _llseek(li_8, 0, 0);
if (li_12 < 0) {
Print("Error placing the pointer");
return ("");
}
string ls_ret_16 = "";
string ls_24 = "x";
int count_32 = 0;
for (li_12 = _lread(li_8, ls_24, 1); li_12 > 0; li_12 = _lread(li_8, ls_24, 1)) {
ls_ret_16 = ls_ret_16 + ls_24;
ls_24 = "x";
count_32++;
}
li_12 = _lclose(li_8);
if (li_12 < 0) Print("Error closing file ", as_0);
return (ls_ret_16);
}

// A79016E1BD876ED33625A0F5696389C2
int f0_7() {
f0_9("source.txt", "c:\\source.txt");
string ls_0 = f0_6("c:\\source.txt");
Print(ls_0);
int li_8 = StringFind(ls_0, "StopLoss = ", 0);
int li_12 = StringFind(ls_0, ";", li_8);
StopLoss = StrToInteger(StringSubstr(ls_0, li_8 + 11, li_12 - li_8 - 11));
Print(" StopLoss : ", StopLoss);
li_8 = StringFind(ls_0, "TakeProfit = ", li_12);
li_12 = StringFind(ls_0, ";", li_8);
TakeProfit = StrToInteger(StringSubstr(ls_0, li_8 + 13, li_12 - li_8 - 13));
Print(" TakeProfit : ", TakeProfit);
li_8 = StringFind(ls_0, "TrailingStop = ", li_12);
li_12 = StringFind(ls_0, ";", li_8);
TrailingStop = StrToInteger(StringSubstr(ls_0, li_8 + 15, li_12 - li_8 - 15));
Print(" TrailingStop : ", TrailingStop);
li_8 = StringFind(ls_0, "TrailingStep = ", li_12);
li_12 = StringFind(ls_0, ";", li_8);
TrailingStep = StrToInteger(StringSubstr(ls_0, li_8 + 15, li_12 - li_8 - 15));
Print(" TrailingStep : ", TrailingStep);
li_8 = StringFind(ls_0, "ReverseTP = ", li_12);
li_12 = StringFind(ls_0, ";", li_8);
ReverseTP = StrToInteger(StringSubstr(ls_0, li_8 + 12, li_12 - li_8 - 12));
Print(" ReverseTP : ", ReverseTP);
return (1);
}*/
//+------------------------------------------------------------------+

相关资源

暂无评论

暂无评论...