النتائج 1 إلى 3 من 3
الموضوع: اسرع دخول مااركت
- 22-09-2017, 03:19 AM #1
اسرع دخول مااركت
اسفل خبيرين نفس الشيء لمنصات MQ5 ومنصات MQ4
لمنصات MQ4
كود PHP:input double Lot=0.01;
//+---------------------------
void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
{
MqlTick last_tick;
SymbolInfoTick(_Symbol,last_tick);
if(ObjectGetInteger(0,"BUY",OBJPROP_STATE)!=0)
{
ObjectSetInteger(0,"BUY",OBJPROP_STATE,0);
if(!OrderSend(_Symbol,OP_BUY,Lot,last_tick.ask,3,0,0,NULL,66,0,clrNONE))
return;
}
if(ObjectGetInteger(0,"SELL",OBJPROP_STATE)!=0)
{
ObjectSetInteger(0,"SELL",OBJPROP_STATE,0);
if(!OrderSend(_Symbol,OP_SELL,Lot,last_tick.bid,3,0,0,NULL,66,0,clrNONE))
return;
}
}
//+-----------------------------
int OnInit()
{
ObjectCreate(0,"BUY",OBJ_BUTTON,0,0,0);
ObjectSetInteger(0,"BUY",OBJPROP_XDISTANCE,ChartGetInteger(0,CHART_WIDTH_IN_PIXELS)-100);
ObjectSetInteger(0,"BUY",OBJPROP_YDISTANCE,50);
ObjectSetString(0,"BUY",OBJPROP_TEXT,"Buy");
ObjectCreate(0,"SELL",OBJ_BUTTON,0,0,0);
ObjectSetInteger(0,"SELL",OBJPROP_XDISTANCE,ChartGetInteger(0,CHART_WIDTH_IN_PIXELS)-100);
ObjectSetInteger(0,"SELL",OBJPROP_YDISTANCE,80);
ObjectSetString(0,"SELL",OBJPROP_TEXT,"Sell");
return(0);
}
//+------------------------------------
void OnDeinit(const int reason)
{
//---
ObjectDelete(0,"BUY");
ObjectDelete(0,"SELL");
}
//+-------------------------------------
void OnTick()
{
//---
}
آخر تعديل بواسطة فيلسوف البادية ، 22-09-2017 الساعة 03:24 AM
- 22-09-2017, 03:22 AM #2
وهنا لمنصات MQ5
كود PHP:input double Lot=0.1;
//+------------------------------------------------------------------+
int OnInit()
{
ObjectCreate(0,"BUY",OBJ_BUTTON,0,0,0);
ObjectSetInteger(0,"BUY",OBJPROP_XDISTANCE,ChartGetInteger(0,CHART_WIDTH_IN_PIXELS)-100);
ObjectSetInteger(0,"BUY",OBJPROP_YDISTANCE,50);
ObjectSetString(0,"BUY",OBJPROP_TEXT,"Buy");
ObjectCreate(0,"SELL",OBJ_BUTTON,0,0,0);
ObjectSetInteger(0,"SELL",OBJPROP_XDISTANCE,ChartGetInteger(0,CHART_WIDTH_IN_PIXELS)-100);
ObjectSetInteger(0,"SELL",OBJPROP_YDISTANCE,80);
ObjectSetString(0,"SELL",OBJPROP_TEXT,"Sell");
return(0);
}
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
ObjectDelete(0,"BUY");
ObjectDelete(0,"SELL");
}
//+------------------------------------------------------------------+
void OnTick()
{
//---
}
//+------------------------------------------------------------------+
void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
{
MqlTick last_tick;
SymbolInfoTick(_Symbol,last_tick);
MqlTradeResult result;
MqlTradeRequest request;
ZeroMemory(request);
ZeroMemory(result);
request.symbol=_Symbol;
request.magic=66;
request.deviation=3;
request.action=TRADE_ACTION_DEAL;
request.type_filling=ORDER_FILLING_FOK;
if(ObjectGetInteger(0,"BUY",OBJPROP_STATE)!=0)
{
ObjectSetInteger(0,"BUY",OBJPROP_STATE,0);
request.volume=Lot;
request.price=last_tick.ask;
request.type=ORDER_TYPE_BUY;
if(!OrderSend(request,result))
return;
}
if(ObjectGetInteger(0,"SELL",OBJPROP_STATE)!=0)
{
ObjectSetInteger(0,"SELL",OBJPROP_STATE,0);
request.volume=Lot;
request.price=last_tick.bid;
request.type=ORDER_TYPE_SELL;
if(!OrderSend(request,result)) return;
}
}
- 28-09-2017, 02:50 AM #3
ممكن شرح سريع بوسلمان