LIP/Arch/RU/LIP_v01.005/Include/LIP_Fun2_5_v1.005.mqh

667 lines
56 KiB
MQL5
Raw Permalink Normal View History

2025-05-30 15:03:51 +02:00
<EFBFBD><EFBFBD>//============================================================================================= MQL5 ===
// LibreInfoPDO Function2_5 v1.005 MQL5
// A=>2=K5 B5E=8G5A:85 @0AG5BK
// Librecoin (c)2014-2017
//======================================================================================================
#property strict
//============================================================================================= MQL5 ===
// INCLUDE - ?>4:;NG05<K5 <>4C;8
//------------------------------------------------------------------------------------------------------
//----- 1@0B=K5 AAK;:8 =0 >A=>2=>9 D09; ?@>5:B0
#include "LIP_Ref_5_v1.005.mqh"
//============================================================================================= MQL5 ===
// FUNCTIONS
//------------------------------------------------------------------------------------------------------
//
//============================================================================================= MQL5 ===
// FillSymSelect() - 0?>;=5=85 <0AA820 >1@07F>2 >B1>@0
// E>4:
// iSelectArray - <0AA82 >B1>@0 >1@07F>2
//------------------------------------------------------------------------------------------------------
void FillSymSelect(string &iSelectArray[]){
//-----
string iSymSelect_00=SymSelect_00;
string iSymSelect_01=SymSelect_01;
string iSymSelect_02=SymSelect_02;
string iSymSelect_03=SymSelect_03;
string iSymSelect_04=SymSelect_04;
string iSymSelect_05=SymSelect_05;
string iSymSelect_06=SymSelect_06;
string iSymSelect_07=SymSelect_07;
string iSymSelect_08=SymSelect_08;
string iSymSelect_09=SymSelect_09;
StringTrimLeft(iSymSelect_00);StringTrimRight(iSymSelect_00);iSelectArray[0]=iSymSelect_00;
StringTrimLeft(iSymSelect_01);StringTrimRight(iSymSelect_01);iSelectArray[1]=iSymSelect_01;
StringTrimLeft(iSymSelect_02);StringTrimRight(iSymSelect_02);iSelectArray[2]=iSymSelect_02;
StringTrimLeft(iSymSelect_03);StringTrimRight(iSymSelect_03);iSelectArray[3]=iSymSelect_03;
StringTrimLeft(iSymSelect_04);StringTrimRight(iSymSelect_04);iSelectArray[4]=iSymSelect_04;
StringTrimLeft(iSymSelect_05);StringTrimRight(iSymSelect_05);iSelectArray[5]=iSymSelect_05;
StringTrimLeft(iSymSelect_06);StringTrimRight(iSymSelect_06);iSelectArray[6]=iSymSelect_06;
StringTrimLeft(iSymSelect_07);StringTrimRight(iSymSelect_07);iSelectArray[7]=iSymSelect_07;
StringTrimLeft(iSymSelect_08);StringTrimRight(iSymSelect_08);iSelectArray[8]=iSymSelect_08;
StringTrimLeft(iSymSelect_09);StringTrimRight(iSymSelect_09);iSelectArray[9]=iSymSelect_09;
//-----
return;
}//FillSymSelect()
//
//============================================================================================= MQL5 ===
// FillSymEliminat() - 0?>;=5=85 <0AA820 >1@07F>2 >BA520
// E>4:
// iSelectArray - <0AA82 >BA520 >1@07F>2
//------------------------------------------------------------------------------------------------------
void FillSymEliminat(string &iSelectArray[]){
//-----
string iSymSelect_00=SymEliminat_00;
string iSymSelect_01=SymEliminat_01;
string iSymSelect_02=SymEliminat_02;
string iSymSelect_03=SymEliminat_03;
string iSymSelect_04=SymEliminat_04;
string iSymSelect_05=SymEliminat_05;
string iSymSelect_06=SymEliminat_06;
string iSymSelect_07=SymEliminat_07;
string iSymSelect_08=SymEliminat_08;
string iSymSelect_09=SymEliminat_09;
StringTrimLeft(iSymSelect_00);StringTrimRight(iSymSelect_00);iSelectArray[0]=iSymSelect_00;
StringTrimLeft(iSymSelect_01);StringTrimRight(iSymSelect_01);iSelectArray[1]=iSymSelect_01;
StringTrimLeft(iSymSelect_02);StringTrimRight(iSymSelect_02);iSelectArray[2]=iSymSelect_02;
StringTrimLeft(iSymSelect_03);StringTrimRight(iSymSelect_03);iSelectArray[3]=iSymSelect_03;
StringTrimLeft(iSymSelect_04);StringTrimRight(iSymSelect_04);iSelectArray[4]=iSymSelect_04;
StringTrimLeft(iSymSelect_05);StringTrimRight(iSymSelect_05);iSelectArray[5]=iSymSelect_05;
StringTrimLeft(iSymSelect_06);StringTrimRight(iSymSelect_06);iSelectArray[6]=iSymSelect_06;
StringTrimLeft(iSymSelect_07);StringTrimRight(iSymSelect_07);iSelectArray[7]=iSymSelect_07;
StringTrimLeft(iSymSelect_08);StringTrimRight(iSymSelect_08);iSelectArray[8]=iSymSelect_08;
StringTrimLeft(iSymSelect_09);StringTrimRight(iSymSelect_09);iSelectArray[9]=iSymSelect_09;
//-----
return;
}//FillTickEliminat()
//
//============================================================================================= MQL5 ===
// FillMagSelect() - 0?>;=5=85 <0AA820 >1@07F>2 >B1>@0
// E>4:
// iSelectArray - <0AA82 >B1>@0 >1@07F>2
//------------------------------------------------------------------------------------------------------
void FillMagSelect(long &iSelectArray[]){
//-----
iSelectArray[0]=StringToInteger(MagSelect_00);
iSelectArray[1]=StringToInteger(MagSelect_01);
iSelectArray[2]=StringToInteger(MagSelect_02);
iSelectArray[3]=StringToInteger(MagSelect_03);
iSelectArray[4]=StringToInteger(MagSelect_04);
iSelectArray[5]=StringToInteger(MagSelect_05);
iSelectArray[6]=StringToInteger(MagSelect_06);
iSelectArray[7]=StringToInteger(MagSelect_07);
iSelectArray[8]=StringToInteger(MagSelect_08);
iSelectArray[9]=StringToInteger(MagSelect_09);
//-----
return;
}//FillMagSelect()
//
//============================================================================================= MQL5 ===
// FillMagEliminat() - 0?>;=5=85 <0AA820 >1@07F>2 >BA520
// E>4:
// iSelectArray - <0AA82 >BA520 >1@07F>2
//------------------------------------------------------------------------------------------------------
void FillMagEliminat(long &iSelectArray[]){
//-----
iSelectArray[0]=StringToInteger(MagEliminat_00);
iSelectArray[1]=StringToInteger(MagEliminat_01);
iSelectArray[2]=StringToInteger(MagEliminat_02);
iSelectArray[3]=StringToInteger(MagEliminat_03);
iSelectArray[4]=StringToInteger(MagEliminat_04);
iSelectArray[5]=StringToInteger(MagEliminat_05);
iSelectArray[6]=StringToInteger(MagEliminat_06);
iSelectArray[7]=StringToInteger(MagEliminat_07);
iSelectArray[8]=StringToInteger(MagEliminat_08);
iSelectArray[9]=StringToInteger(MagEliminat_09);
//-----
return;
}//FillMagEliminat()
//
//============================================================================================= MQL5 ===
// FillTickSelect() - 0?>;=5=85 <0AA820 >1@07F>2 >B1>@0
// E>4:
// iSelectArray - <0AA82 >B1>@0 >1@07F>2
//------------------------------------------------------------------------------------------------------
void FillTickSelect(long &iSelectArray[]){
//-----
iSelectArray[0]=StringToInteger(TickSelect_00);
iSelectArray[1]=StringToInteger(TickSelect_01);
iSelectArray[2]=StringToInteger(TickSelect_02);
iSelectArray[3]=StringToInteger(TickSelect_03);
iSelectArray[4]=StringToInteger(TickSelect_04);
iSelectArray[5]=StringToInteger(TickSelect_05);
iSelectArray[6]=StringToInteger(TickSelect_06);
iSelectArray[7]=StringToInteger(TickSelect_07);
iSelectArray[8]=StringToInteger(TickSelect_08);
iSelectArray[9]=StringToInteger(TickSelect_09);
//-----
return;
}//FillTickSelect()
//
//============================================================================================= MQL5 ===
// FillTickEliminat() - 0?>;=5=85 <0AA820 >1@07F>2 >BA520
// E>4:
// iSelectArray - <0AA82 >BA520 >1@07F>2
//------------------------------------------------------------------------------------------------------
void FillTickEliminat(long &iSelectArray[]){
//-----
iSelectArray[0]=StringToInteger(TickEliminat_00);
iSelectArray[1]=StringToInteger(TickEliminat_01);
iSelectArray[2]=StringToInteger(TickEliminat_02);
iSelectArray[3]=StringToInteger(TickEliminat_03);
iSelectArray[4]=StringToInteger(TickEliminat_04);
iSelectArray[5]=StringToInteger(TickEliminat_05);
iSelectArray[6]=StringToInteger(TickEliminat_06);
iSelectArray[7]=StringToInteger(TickEliminat_07);
iSelectArray[8]=StringToInteger(TickEliminat_08);
iSelectArray[9]=StringToInteger(TickEliminat_09);
//-----
return;
}//FillTickEliminat()
//
//============================================================================================= MQL5 ===
// GlobalSetDouble - #AB0=>28BL 3;>10;L=CN ?5@5<5==CN double
//------------------------------------------------------------------------------------------------------
bool GlobalSetDouble(string iName,datetime &iTimeSet,double iDateSet=0.0){
//-----
iTimeSet=GlobalVariableSet(iName,iDateSet);
{if(iTimeSet!=0)//=0G5=85 C40;>AL CAB0=>28BL
{
return(true);
}else{//5 C40;>AL CAB0=>28BL
return(false);
}}//if(iTimeSet!=0)
//-----
return(false);
}//GlobalSetDouble()
//
//============================================================================================= MQL5 ===
// GlobalGetDouble - @>G8B0BL 3;>10;L=CN ?5@5<5==CN double
//------------------------------------------------------------------------------------------------------
bool GlobalGetDouble(string iName,double &iDateGet){
//-----
iDateGet=0.0;
{if(GlobalVariableCheck(iName))//5@5<5==0O 5ABL
{
{if(GlobalVariableGet(iName,iDateGet))//=0G5=85 C40;>AL AG8B0BL
{
return(true);
}else{//5 C40;>AL AG8B0BL
iDateGet=0.0;
return(false);
}}//if(GlobalVariableGet(iName,iDateGet))
}else{//5@5<5==>9 =5B
iDateGet=0.0;
return(false);
}}//if(GlobalVariableCheck(iName))
//-----
return(false);
}//GlobalGetDouble()
//
//============================================================================================= MQL5 ===
// GlobalSetString - #AB0=>28BL 3;>10;L=CN ?5@5<5==CN string (8A8<2)
//------------------------------------------------------------------------------------------------------
bool GlobalSetString(string iName,datetime &iTimeSet,string iStringSet=""){
//-----
union ulong_double
{
double iDateSet;
ulong iLongSet;
uchar iCharSet[8];
};
ulong_double ud;
ud.iLongSet=0;
//-----
StringToCharArray(iStringSet,ud.iCharSet,0,8);
//-----
iTimeSet=GlobalVariableSet(iName,ud.iDateSet);
{if(iTimeSet!=0)//=0G5=85 C40;>AL CAB0=>28BL
{
return(true);
}else{//5 C40;>AL CAB0=>28BL
return(false);
}}//if(iTimeSet!=0)
//-----
return(false);
}//GlobalSetString()
//
//============================================================================================= MQL5 ===
// GlobalGetString - @>G8B0BL 3;>10;L=CN ?5@5<5==CN string (8A8<2)
//------------------------------------------------------------------------------------------------------
bool GlobalGetString(string iName,string &iStringGet){
//-----
iStringGet="";
//-----
union ulong_double
{
double iDateGet;
ulong iLongGet;
uchar iCharGet[8];
};
ulong_double ud;
ud.iLongGet=0;
//-----
{if(GlobalVariableCheck(iName))//5@5<5==0O 5ABL
{
{if(GlobalVariableGet(iName,ud.iDateGet))//=0G5=85 C40;>AL AG8B0BL
{
iStringGet=CharArrayToString(ud.iCharGet,0,8);
return(true);
}else{//5 C40;>AL AG8B0BL
iStringGet="";
return(false);
}}//if(GlobalVariableGet(iName,ud.iDateGet))
}else{//5@5<5==>9 =5B
iStringGet="";
return(false);
}}//if(GlobalVariableCheck(iName))
//-----
iStringGet="";
return(false);
}//GlobalGetString()
//
//============================================================================================= MQL5 ===
// GlobalSetUlong - #AB0=>28BL 3;>10;L=CN ?5@5<5==CN ulong
//------------------------------------------------------------------------------------------------------
bool GlobalSetUlong(string iName,datetime &iTimeSet,ulong iUlongSet=0){
//-----
union ulong_double
{
double iDateSet;
ulong iLongSet;
};
ulong_double ud;
ud.iLongSet=iUlongSet;
//-----
iTimeSet=GlobalVariableSet(iName,ud.iDateSet);
{if(iTimeSet!=0)//=0G5=85 C40;>AL CAB0=>28BL
{
return(true);
}else{//5 C40;>AL CAB0=>28BL
return(false);
}}//if(GlobalVariableGet(iName,iDate))
//-----
return(false);
}//GlobalSetDouble()
//
//============================================================================================= MQL5 ===
// GlobalGetUlong - @>G8B0BL 3;>10;L=CN ?5@5<5==CN ulong
//------------------------------------------------------------------------------------------------------
bool GlobalGetUlong(string iName,ulong &iUlongGet){
//-----
iUlongGet=0;
//-----
union ulong_double
{
double iDateGet;
ulong iLongGet;
};
ulong_double ud;
ud.iLongGet=0;
//-----
{if(GlobalVariableCheck(iName))//5@5<5==0O 5ABL
{
{if(GlobalVariableGet(iName,ud.iDateGet))//=0G5=85 C40;>AL AG8B0BL
{
iUlongGet=ud.iLongGet;
return(true);
}else{//5 C40;>AL AG8B0BL
iUlongGet=0;
return(false);
}}//if(GlobalVariableGet(iName,iDate))
}else{//5@5<5==>9 =5B
iUlongGet=0;
return(false);
}}//if(GlobalVariableCheck(iName))
//-----
iUlongGet=0;
return(false);
}//GlobalGetDouble()
//
//============================================================================================= MQL5 ===
// CheckCondition - @>25@:0 CA;>28O >B:@KB8O
// E:
// iOpenMethod : 5B>4 D>@<8@>20=8O A83=0;0 =0 2E>4;
// iCloseProfitMethod : 5B>4 D>@<8@>20=8O A83=0;0 =0 2KE>4 ?> ?@81K;8;
// iCloseLossMethod : 5B>4 D>@<8@>20=8O A83=0;0 =0 2KE>4 ?> C1KB:C;
// KE:
// iCommand : B8? :><0=4K
// iPosType : B8? >B:@K205<>9 ?>78F88
// bool : 5ABL CA;>285 >B:@KB8O
//------------------------------------------------------------------------------------------------------
bool CheckCondition( enOpenMethod iOpenMethod,
enCloseProfitMethod iCloseProfitMethod,
enCloseLossMethod iCloseLossMethod,
enCommandType &iCommand,
ENUM_POSITION_TYPE &iPosType){
//-----
iCommand=Command_None;
//----- !G8BK205< 7=0G5=8O 0 8 1 10@>2 8=48:0B>@0 ADXW_ZAT_116 by Welles Wilder (LibreCoin adapted)
{if(((iOpenMethod==Open_ADXW)||(iCloseProfitMethod==CloseProfit_ADXW)||(iCloseLossMethod==CloseLoss_ADXW))
&&(CopyBuffer(adxw_handle,0,0,2,m_adxw)<2)
)
{
{if(PrintDebug){Print("CheckCondition(): Error: CopyBuffer(adxw_handle)<2");}}
return(false);
}}//if(((iOpenMethod==Open_ADXW)||(iCloseProfitMethod==CloseProfit_ADXW)||(iCloseLossMethod==CloseLoss_ADXW))
if(PrintADXW)Print("m_adxw[0]=",m_adxw[0]);
//----- >7<>6=>ABL >B:@KB8O Buy
{if(MathMod(gnTick+0*TestStep,TestStep*24)<0.5)
{
{switch(iOpenMethod)
{
case Open_ADXW: //>7<>6=>ABL >B:@KB8O Buy ?> ADXWZ
{
{if( (m_adxw[0]>aL0)&&(m_adxw[0]<aL1) // 480?07>=5 aL0 >B 4> aL1 (?>;>68B5;L=>5)
&& (m_adxw[0]>m_adxw[1]) // @0ABQB
)
{
iPosType=POSITION_TYPE_BUY; //0
iCommand=Command_Open; //1
return(true);
}}//if(MathMod(gnTick+0*TestStep,TestBase)<0.5)
break;
}
default:
{
iPosType=POSITION_TYPE_BUY; //0
iCommand=Command_Open; //1
return(true);
break;
}
}}//switch(iOpenMethod)
}}//if(MathMod(gnTick+0*TestStep,TestStep*6)<0.5)
//----- >7<>6=>ABL >B:@KB8O Sell
{if(MathMod(gnTick+3*TestStep,TestStep*24)<0.5)
{
{switch(iOpenMethod)
{
case Open_ADXW: //>7<>6=>ABL >B:@KB8O Sell ?> ADXWZ
{
{if( (m_adxw[0]<-aL0)&&(m_adxw[0]>-aL1) // 480?07>=5 -aL1 >B 4> -aL0 (>B@8F0B5;L=>5)
&& (m_adxw[0]<m_adxw[1]) // ?0405B
)
{
iPosType=POSITION_TYPE_SELL; //1
iCommand=Command_Open; //1
return(true);
}}//if(MathMod(gnTick+2*TestStep,TestBase)<0.5)
break;
}
default:
{
iPosType=POSITION_TYPE_BUY; //1
iCommand=Command_Open; //1
return(true);
break;
}
}}//switch(iOpenMethod)
}}//if(MathMod(gnTick+3*TestStep,TestStep*6)<0.5)
//----- >7<>6=>ABL 70:@KB8O Buy (2 ?@81K;8 - >F5=:0 ?@81K;8 2 A>25B=8:5)
{if(MathMod(gnTick+1*TestStep,TestStep*12)<0.5)
{
{switch(iCloseProfitMethod)
{
case CloseProfit_ADXW: //>7<>6=>ABL 70:@KB8O Buy ?> ADXWZ (2 ?@81K;8 - >F5=:0 ?@81K;8 2 A>25B=8:5)
{
{if( ((m_adxw[0]<m_adxw[1])&&(m_adxw[0]>aL0)) //ADXWZ ?0405B 8 1>;LH5 C@>2=O >B:@KB8O
|| (m_adxw[0]>aL2) //8;8 1>;LH5 aL2
)
{
iPosType=POSITION_TYPE_BUY; //0
iCommand=Command_Close; //2
return(true);
}}//if( (m_adxw[0]<m_adxw[1])
break;
}
default:
{
iPosType=POSITION_TYPE_BUY; //0
iCommand=Command_Close; //2
return(true);
break;
}
}}//switch(iOpenMethod)
}}//if(MathMod(gnTick+1*TestStep,TestStep*6)<0.5)
//----- >7<>6=>ABL 70:@KB8O Sell (2 ?@81K;8 - >F5=:0 ?@81K;8 2 A>25B=8:5)
{if(MathMod(gnTick+4*TestStep,TestStep*12)<0.5)
{
{switch(iCloseProfitMethod)
{
case CloseProfit_ADXW: //>7<>6=>ABL 70:@KB8O Sell ?> ADXWZ (2 ?@81K;8 - >F5=:0 ?@81K;8 2 A>25B=8:5)
{
{if( ((m_adxw[0]>m_adxw[1])&&(m_adxw[0]<-aL0)) //ADXWZ @0AB5B 8 <5=LH5 C@>2=O >B:@KB8O (=530B82=>3>)
|| (m_adxw[0]<-aL2) //8;8 <5=LH5 -aL2
)
{
iPosType=POSITION_TYPE_SELL; //1
iCommand=Command_Close; //2
return(true);
}}//if(MathMod(gnTick+3*TestStep,TestBase)<0.5)
break;
}
default:
{
iPosType=POSITION_TYPE_SELL; //0
iCommand=Command_Close; //2
return(true);
break;
}
}}//switch(iCloseProfitMethod)
}}//if(MathMod(gnTick+4*TestStep,TestStep*6)<0.5)
//----- >7<>6=>ABL 70:@KB8O Buy (2 C1KB:5 - >F5=:0 C1KB:0 2 A>25B=8:5)
{if(MathMod(gnTick+2*TestStep,TestStep*6)<0.5)
{
{switch(iCloseLossMethod)
{
case CloseLoss_ADXW: //>7<>6=>ABL 70:@KB8O Buy ?> ADXWZ (2 C1KB:5 - >F5=:0 C1KB:0 2 A>25B=8:5)
{
{if((m_adxw[0]<-aL3)&&(m_adxw[0]<m_adxw[1])) //ADXWZ =530B82=K9 <5=LH5 C@>2=O 70:@KB8O 8 C<5=LH05BAO
{
iPosType=POSITION_TYPE_BUY; //0
iCommand=Command_CloseLoss; //3
return(true);
}}//if(m_adxw[0]<-aL3)
break;
}
default:
{
iPosType=POSITION_TYPE_BUY; //0
iCommand=Command_CloseLoss; //2
return(true);
break;
}
}}//switch(iCloseProfitMethod)
}}//if(MathMod(gnTick+4*TestStep,TestStep*6)<0.5)
//----- >7<>6=>ABL 70:@KB8O Sell (2 C1KB:5 - >F5=:0 C1KB:0 2 A>25B=8:5)
{if(MathMod(gnTick+5*TestStep,TestStep*6)<0.5)
{
{switch(iCloseLossMethod)
{
case CloseLoss_ADXW: //>7<>6=>ABL 70:@KB8O Sell ?> ADXWZ (2 C1KB:5 - >F5=:0 ?@81K;8 2 A>25B=8:5)
{
{if((m_adxw[0]>aL3)&&(m_adxw[0]<m_adxw[1])) //ADXWZ ?>78B82=K9 1>;LH5 C@>2=O 70:@KB8O 8 C25;8G8205BAO
{
iPosType=POSITION_TYPE_SELL; //1
iCommand=Command_CloseLoss; //3
return(true);
}}//if(MathMod(gnTick+3*TestStep,TestBase)<0.5)
break;
}
default:
{
iPosType=POSITION_TYPE_SELL; //0
iCommand=Command_CloseLoss; //2
return(true);
break;
}
}}//switch(iCloseProfitMethod)
}}//if(MathMod(gnTick+4*TestStep,TestStep*6)<0.5)
//-----
return(false);
}//CheckCondition()
//
//============================================================================================= MQL5 ===
// CommandCode - D>@<8@>20=85 :>40 :><0=4K ?> B8?C :><0=4K 8 B8?C ?>78F88
// E:
// iCommand : B8? :><0=4K (Command_None/Command_Open/Command_Close)
// iPosType : B8? ?>78F88 (Buy/Sell)
// KE:
// ulong : :>4 :><0=4K (0/1/2/3/4) - (=5B:><0=4K/?>:C?:0/?@>4060/70:@KB85?>:C?:8/70:@KB85?@>4068)
//------------------------------------------------------------------------------------------------------
ulong CommandCode(enCommandType iCommand, //B8? :><0=4K
ENUM_POSITION_TYPE iPosType){ //B8? ?>78F88
//----- Demo
{if(iCommand==Command_Open)
{
{if(iPosType==POSITION_TYPE_BUY)
{
return(1);//>:C?0BL
}}//if(iPosType==POSITION_TYPE_BUY)
{if(iPosType==POSITION_TYPE_SELL)
{
return(2);//@>4020BL
}}//if(iPosType==POSITION_TYPE_SELL)
}}//if(iCommand==Commmand_Open)
{if(iCommand==Command_Close)
{
{if(iPosType==POSITION_TYPE_BUY)
{
return(3);//0:@KBL >:C?:C 2 ?@81K;L
}}//if(iPosType==POSITION_TYPE_BUY)
{if(iPosType==POSITION_TYPE_SELL)
{
return(4);//0:@KBL @>406C 2 ?@81K;L
}}//if(iPosType==POSITION_TYPE_SELL)
}}//if(iCommand==Commmand_Close)
{if(iCommand==Command_CloseLoss)
{
{if(iPosType==POSITION_TYPE_BUY)
{
return(5);//0:@KBL >:C?:C 2 C1KB>:
}}//if(iPosType==POSITION_TYPE_BUY)
{if(iPosType==POSITION_TYPE_SELL)
{
return(6);//0:@KBL @>406C 2 C1KB>:
}}//if(iPosType==POSITION_TYPE_SELL)
}}//if(iCommand==Commmand_Close)
return(0);//=5B :><0=4K
}//CommandCode()
//
//============================================================================================= MQL5 ===
// SendCommand - >B?@02:0 :><0=4K 2 A>25B=8:
//------------------------------------------------------------------------------------------------------
void SendCommand(ulong iCommandCode){
//-----
datetime TimeSet=0;
//1. !1@0AK205BAO D;03 2K?>;=5=8O (:><0=40 2K?>;=8BL ?>:C?:C =5 2K?>;=5=0)
{if(GlobalSetUlong("LIP_"+TheSymbol+"_Ready_"+IntegerToString(iCommandCode),TimeSet,0))
{
if(PrintDebug)Print("=4 LIP_"+TheSymbol+"_Ready_"+IntegerToString(iCommandCode)+"=",0);
}}//if(GlobalSetUlong("LIP_"+TheSymbol+"_Ready_"+EnumToString(iCommandCode),TimeSet,0))
//2. KAB02;O5BAO :><0=40 (2K?>;=8BL ?>:C?:C)
{if(GlobalSetUlong("LIP_"+TheSymbol+"_Command_"+IntegerToString(iCommandCode),TimeSet,iCommandCode))
{
if(PrintDebug)Print("=4 LIP_"+TheSymbol+"_Command_"+IntegerToString(iCommandCode)+"=",iCommandCode);
}}//if(GlobalSetUlong("LIP_"+TheSymbol+"_Command"+EnumToString(iCommandCode),TimeSet,iCommandCode))
if(PrintDebug)Print("=4 7040G0 "+IntegerToString(iCommandCode)+" 70?CI5=0!");
//DoItCommand=true;
}//SendCommand()
////
////============================================================================================= MQL5 ===
//// CheckOpenCondition - @>25@:0 CA;>28O >B:@KB8O
//// KE:
//// iPosType : B8? >B:@K205<>9 ?>78F88
//// bool : 5ABL CA;>285 >B:@KB8O
////------------------------------------------------------------------------------------------------------
//bool CheckOpenCondition(ENUM_POSITION_TYPE &iPosType){
////----- Demo
// {if(MathMod(gnTick+0*TestStep,TestBase)<0.5)
// {
// iPosType=POSITION_TYPE_BUY;
// return(true);
// }}//if(MathMod(gnTick,100)<1)
// {if(MathMod(gnTick+2*TestStep,TestBase)<0.5)
// {
// iPosType=POSITION_TYPE_SELL;
// return(true);
// }}//if(MathMod(gnTick+50,100)<1)
// return(false);
//}//CheckOpenCondition()
////
////============================================================================================= MQL5 ===
//// CheckCloseCondition - @>25@:0 CA;>28O 70:@KB8O
//// KE:
//// iPosType : B8? 70:@K205<>9 ?>78F88
//// bool : 5ABL CA;>285 70:@KB8O
////------------------------------------------------------------------------------------------------------
//bool CheckCloseCondition(ENUM_POSITION_TYPE &iPosType){
////----- Demo
// {if(MathMod(gnTick+1*TestStep,TestBase)<0.5)
// {
// iPosType=POSITION_TYPE_BUY;
// return(true);
// }}//if(MathMod(gnTick+25,100)<1)
// {if(MathMod(gnTick+3*TestStep,TestBase)<0.5)
// {
// iPosType=POSITION_TYPE_SELL;
// return(true);
// }}//if(MathMod(gnTick+75,100)<1)
// return(false);
//}//CheckCloseCondition()
////
////============================================================================================= MQL5 ===
//// CheckCommandResult - ?@>25@:0 @57C;LB0B0 >1@01>B:8 :><0=4K 2 A>25B=8:5
////------------------------------------------------------------------------------------------------------
//void CheckCommandResult(ulong iCommandCode){
////-----
// datetime TimeSet=0;
// {if(DoItCommand)
// {
// ulong UlongSet=0;
// //4. A;8 2K?>;=5=> (>1=0@C65= D;03 2K?>;=5=8O :><0=4K 2K?>;=8BL ?>:C?:C) (B09<0CB - @0AA<>B@5BL >B45;L=>), B> A1@0AK205< D;03 7040=8O 8 D;03 2K?>;=5=8O
// {if((GlobalGetUlong("LIP_"+TheSymbol+"_Ready_"+IntegerToString(iCommandCode),UlongSet))&&(UlongSet!=0))
// {
// //Print("LIP_"+TheSymbol+"_Command=",UlongSet);
// //A1@0AK205< D;03 7040=8O
// DoItCommand=false;
// //1. !1@0AK205BAO D;03 2K?>;=5=8O (:><0=40 2K?>;=8BL ?>:C?:C =5 2K?>;=5=0)
// {if(GlobalSetUlong("LIP_"+TheSymbol+"_Ready_"+IntegerToString(iCommandCode),TimeSet,0))
// {
// if(PrintInfo)Print("=4 7040G0 "+IntegerToString(UlongSet)+" 2K?>;=5=0! "+string(TimeSet));
// }}//if(GlobalSetString("tst_03",TimeSet,56456198741))
// }}//if(GlobalGetUlong("tst_03",UlongSet))
// }}//if(DoItCommand)
//}//CheckCommandResult()
//
//----- #AB0=>2:0 3;>10;L=KE ?5@5<5==KE
//datetime TimeSet=0;
//double DateSet=0.0;
//{if(GlobalSetDouble("LIP_"+TheSymbol+"_Ask",TimeSet,SymbolInfoDouble(TheSymbol,SYMBOL_ASK)))
//{
// //Print("TimeSet1=",TimeSet);
// //{if(GlobalGetDouble("tst_01",DateSet))
// //{
// // Print("DateSet1=",DateSet);
// //}}//if(GlobalGetDouble("tst_01",DateSet))
//}}//if(GlobalSetDouble("tst_01",999.999,TimeSet))
//{if(GlobalSetDouble("LIP_"+TheSymbol+"_Bid",TimeSet,SymbolInfoDouble(TheSymbol,SYMBOL_BID)))
//{
// //Print("TimeSet1=",TimeSet);
// //{if(GlobalGetDouble("tst_01",DateSet))
// //{
// // Print("DateSet1=",DateSet);
// //}}//if(GlobalGetDouble("tst_01",DateSet))
//}}//if(GlobalSetDouble("tst_01",999.999,TimeSet))
//-----
//string StringSet="";
//{if(GlobalSetString("LIP_"+TheSymbol+"_Symbol",TimeSet,TheSymbol))
//{
// //Print("TimeSet2=",TimeSet);
// //{if(GlobalGetString("tst_02",StringSet))
// //{
// // Print("StringSet2=",StringSet);
// //}}//if(GlobalGetString("tst_02",StringSet))
//}}//if(GlobalSetString("tst_02",TimeSet,"EURUSD.z"))