[存档!]任何菜鸟问题,为了不使论坛变得混乱。专业人士,不要路过。没有你,哪里都不能去 - 4. - 页 139

 
CLAIN:

有趣的是,存款是足够的 - 我在那里有大量的储备。
开仓后,立即在Print()中输出一个错误,看看原因。
 

问题。

我已经写了一个指标。使用的主要函数Order和Account是Symbol()到处是iClose iOpen。但由于某些原因,该指标只在EURUSD............。我试过其他的工具,都挂了()。

该指标的实质是:显示账户信息、自由资金、开仓手数、开仓金额、资金利润/风险比率,仅在(OrderSymbol()!=Symbol())继续设置。

重新审视了10-20次的原因。我不明白...((((

预先感谢

 
sergeev:

勾选

事实证明,MT4中音量组的所有指标都显示刻度线音量
 
paladin80:
在开仓后,立即打印(),看看出错的原因。


有趣的是,测试器上没有任何问题。从2000年到现在,它一直在工作,没有任何流失。

代码会有帮助吗?

//+------------------------------------------------------------------+ 
//| StMartin.mq4 | 
//| Sergey Kodolov | 
//| 84232676421@mail.ru | 
//+------------------------------------------------------------------+ 
#property copyright "Sergey Kodolov" 
#property link "84232676421@mail.ru" 

    extern int TP = 1000; 
    extern int TS = 1000; 
    extern double lots = 1.0; 

    double volumz; 
    int ticket,total; 
    int slip = 3; 
    int Magic = 7; 

 


//+------------------------------------------------------------------+ 
//| expert initialization function | 
//+------------------------------------------------------------------+ 
int init() 
  { 
//---- 

        ticket = OrderSend(Symbol(),OP_BUY,lots,Ask,slip,Bid-TS*Point,Bid+TP*Point,"First order",Magic,0,Yellow); //открываем первый ордер 
 
//---- 
   return(0); 
  } 
//+------------------------------------------------------------------+ 
//| expert deinitialization function | 
//+------------------------------------------------------------------+ 
int deinit() 
  { 
//---- 

//---- 
   return(0); 
  } 
//+------------------------------------------------------------------+ 
//| expert start function | 
//+------------------------------------------------------------------+ 
int start() 
  { 
//---- 

OrderOpenFunction(); 
StrahBuy();
StrahSell();

//---- 
   return(0); 
  } 
//+------------------------------------------------------------------+ 

void OrderOpenFunction()
{
   OrderSelect(ticket,SELECT_BY_TICKET);
   if(OrderCloseTime()>0)
   {
      
      total = OrdersTotal();
      Comment("OrderCloseTime = ",OrderCloseTime()," ms");
      if(total < 1) 
      { 
         OrderSelect(ticket,SELECT_BY_TICKET); 
         volumz = OrderLots(); 
         Print("Orderlots = ", OrderLots());
         if(OrderType() == OP_BUY)
         {
            if(OrderClosePrice()-OrderOpenPrice()>0)
            {
               ticket = OrderSend(Symbol(),OP_BUY,lots,Ask,slip,Bid-TS*Point,Bid+TP*Point,0,Magic,0,Green);
            }
            if(OrderClosePrice()-OrderOpenPrice()<0)
            {
               double lot1 = volumz*2; 
               ticket = OrderSend(Symbol(),OP_SELL,lot1,Bid,slip,Ask+TS*Point,Ask-TP*Point,0,Magic,0,Red); 
            }
         }
         if(OrderType() == OP_SELL)
         {
            if(OrderClosePrice()-OrderOpenPrice()<0)
            {
               ticket = OrderSend(Symbol(),OP_SELL,lots,Bid,slip,Ask+TS*Point,Ask-TP*Point,0,Magic,0,Red);
            }
            if(OrderClosePrice()-OrderOpenPrice()>0)
            {
               double lot2 = volumz*2; 
               ticket = OrderSend(Symbol(),OP_BUY,lot2,Ask,slip,Bid-TS*Point,Bid+TP*Point,0,Magic,0,Green);
            }
         }
      }
   }    
}      
  
void StrahBuy()
{
   total = OrdersTotal();
   if(total<1)
   {
      OrderSelect(0,SELECT_BY_POS);
      if(OrderType() == OP_BUY)
      {
         if(OrderClosePrice()-OrderOpenPrice()>0)
         {
            ticket = OrderSend(Symbol(),OP_BUY,lots,Ask,slip,Bid-TS*Point,Bid+TP*Point,0,Magic,0,Green);
         }
         if(OrderClosePrice()-OrderOpenPrice()<0)
         {
            double lot1 = volumz*2; 
            ticket = OrderSend(Symbol(),OP_SELL,lot1,Bid,slip,Ask+TS*Point,Ask-TP*Point,0,Magic,0,Red); 
         }
      }      
   }
}

void StrahSell()
{
   total = OrdersTotal();
   if(total<1)
   {
      OrderSelect(0,SELECT_BY_POS);
      if(OrderType() == OP_SELL)
      {
         if(OrderClosePrice()-OrderOpenPrice()<0)
         {
            ticket = OrderSend(Symbol(),OP_SELL,lots,Bid,slip,Ask+TS*Point,Ask-TP*Point,0,Magic,0,Red);
         }
         if(OrderClosePrice()-OrderOpenPrice()>0)
         {
            double lot2 = volumz*2; 
            ticket = OrderSend(Symbol(),OP_BUY,lot2,Ask,slip,Bid-TS*Point,Bid+TP*Point,0,Magic,0,Green);
         }
      }
   }   
}

我的意思是,我这里有一个主要功能,其他两个只是重复它。我已经做了保险,但仍然无法工作。

 
CLAIN:


有趣的是,测试器上没有任何问题。从2000年至今,它一直在运行,没有排水。

也许代码会有帮助?

也就是说,我这里有一个主函数,其他两个只是重复它。为保险起见做了这个,但它还是停止工作了

非常奇怪的代码。我很困惑,你在初始化中开了一个头寸,搜索订单时没有为操作员。我以前没有见过这样的事情。在你的代码中插入Print()。相信我,这很有帮助。
 
CLAIN:


有趣的是,在测试器上没有任何问题。从2000年至今,它一直在工作,没有排水。

代码会有帮助吗?

我的意思是,我这里有一个主要功能,其他两个只是重复它。做了保险,但还是停止工作。

测试者:止损#68,在1.2887(1.2885 / 1.2887)。
16:56:31 2010.07.15 15:04 EURUSD,M30: Orderlots = 1
16:56:31 2010.07.15 15:04 测试者:没有足够的钱 在1.2887买入2.00欧元兑美元 sl:1.1885 tp:1.2905 [2010.07.15 15:04]
16:56:31 2010.07.15 15:04 Tester: PrevBalance: 1838.36, PrevPL: 0.00, PrevEquity 1838.36, PrevMargin: 0.00, NewMargin: 2577, FreeMargin: -738.84
16:56:31 2010.07.15 15:04 martin EURUSD,M30:OrderSend error 134

我认为TP=1000,SL=1000是太多了,即使手数=1.0)

试着放一个较小的手和TP=1000,我想你会很高兴。

 

PEOPLE!!!!!!!!! 帮助!!!。请重申!!!那么问题来了:为什么该指标在MT4中只在EURUSD上打开!!!!!!!!!!!!!!!?真是一个谜。指 标中没有配对限制,Symbol()无处不在,主要功能在账户Order和Account。当我移除该指标时,它在另一个货币对上也不工作了,或者说MT4完全挂起,直到我把它切断。我自己写了这个指标。我无法理解其他配对的这种行为。由于它是一个长指标,我不想显示它。但我向你保证,它没有任何不自然的地方,只在eurodollar???????????????????????,工作起来没有问题。

亲身解惑)))))))))))))))))))))))))))))))) 我没有运气.................

以下是关于所用功能的摘录

++++++++++++++++++++++++++++++++++++ 跳过代码

//-----------删除总数对象
Del_comment("MN1趋势")。
Del_comment("W1趋势")。
Del_comment("D1趋势")。
Del_comment("H4趋势")。
Del_comment("H1趋势")。
Del_comment("ord .no: " )。
Del_comment("ord .#: " )。
//---
TRENDS("MN1趋势",PERIOD_MN1, 1,86, 33, Lab_Trend_Bull,Lab_Trend_Bear,Lab_Trend_Doj, 42);
TRENDS("W1趋势", PERIOD_W1, 1,111, 48, Lab_Trend_Bull,Lab_Trend_Bear,Lab_Trend_Doj, 12);
TRENDS("D1趋势", PERIOD_D1, 1,97, 48, Lab_Trend_Bull,Lab_Trend_Bear,Lab_Trend_Doj, 12);
TRENDS("H4趋势", PERIOD_H4, 1,111, 62, Lab_Trend_Bull,Lab_Trend_Bear,Lab_Trend_Doj,12) 。
TRENDS("H1趋势", PERIOD_H1, 1,97, 62, Lab_Trend_Bull,Lab_Trend_Bear,Lab_Trend_Doj, 12);

str=StringLen(AccountCompany())。
if(str<=31) shf=31-str;
否则
如果(str>=31) shf=0。
Commen("NameCo",AccountCompany(), 1, shf, 40, "Times New Roman", color_Fon,7)。
Commen("in",ABC v2, 1, 36, 51, "Times New Roman", color_Fon, 11);
Commen("txt_symb",Symbol(), 1, 3, 64, "Times New Roman", color_Fon,16)。

如果(OffABC==true)
Commen("off+", "OFF", 1, 7, 51, "Times New Roman", color_Loss,10) 。

如果(OffABC==false)
{
Commen("in+", "INC", 1, 7, 51, "Times New Roman", color_Profit,10) 。
int OneLot= MarketInfo(Symbol(),MODE_MARGINREQUIRED)。
int TickValue= MarketInfo(Symbol(),MODE_TICKVALUE)。

if(Digits==2) pips=100;
否则
if(Digits==3) pips=1000;
否则
if(Digits==4) pips=10000;
否则
if(Digits==5) pips=100000;

if(!IsConnected())
{
ObjectDelete("in+")。
Commen("off+", "OFF", 1, 7, 51, "Times New Roman", color_Loss,10) 。
Commen("noconnect", "no connected", 1, 7, 85, "Times New Roman", color_Loss,14) 。
}
否则
如果(IsConnected())
{
ObjectDelete("off+")。
ObjectDelete("noconnect")。
Commen("in+", "INC", 1, 7, 51, "Times New Roman", color_Profit,10) 。
}

如果(AccountCurrency()=="RUB")
{
EQ_USD= AccountEquity()/iClose("USDRUB",PERIOD_M1,0)。
FreeMargin_USD= (AccountFreeMargin()-AccountStopoutLevel())/iClose("USDRUB",PERIOD_M1,0)。
PRF_USD= AccountProfit()/iClose("USDRUB",PERIOD_M1,0)。
LOT_01= (AccountFreeMargin()-AccountStopoutLevel())/(OneLot/10)。
LOT_1= (AccountFreeMargin()-AccountStopoutLevel())/OneLot。
ObjectDelete("nodepo")。
}
否则
如果(AccountCurrency()=="RUR")
{
EQ_USD= AccountEquity()/iClose("USDRUR",PERIOD_M1,0)。
FreeMargin_USD= (AccountFreeMargin()-AccountStopoutLevel())/iClose("USDRUR",PERIOD_M1,0)。
PRF_USD= AccountProfit()/iClose("USDRUR",PERIOD_M1,0)。
LOT_01= (AccountFreeMargin()-AccountStopoutLevel())/(OneLot/10)。
LOT_1= (AccountFreeMargin()-AccountStopoutLevel())/OneLot。
ObjectDelete("nodepo")。
}
否则
if(AccountCurrency()=="EUR")
{
EQ_USD= AccountEquity()*iClose("EURUSD",PERIOD_M1,0)。
FreeMargin_USD= (AccountFreeMargin()-AccountStopoutLevel())*iClose("EURUSD",PERIOD_M1,0)。
PRF_USD= AccountProfit()*iClose("EURUSD",PERIOD_M1,0)。
LOT_01= (AccountFreeMargin()-AccountStopoutLevel())*(OneLot/10)。
LOT_1= (AccountFreeMargin()-AccountStopoutLevel())*OneLot。
ObjectDelete("nodepo")。
}
否则
如果(AccountCurrency()=="USD")
{
EQ_USD= AccountEquity()。
FreeMargin_USD= AccountFreeMargin()-AccountStopoutLevel()。
PRF_USD= AccountProfit()。
LOT_01=FreeMargin_USD/(OneLot/10)。
LOT_1=FreeMargin_USD/OneLot。
ObjectDelete("nodepo")。
}

if(IsConnected() && AccountCurrency()!="RUB" && AccountCurrency()!="RUR" && AccountCurrency()!
{
ObjectDelete("in+")。
ObjectDelete("noconnect")。
Commen("off+", "OFF", 1, 7, 51, "Times New Roman", color_Loss,10) 。
Commen("depo_symbl",AccountCurrency(), 1, 112, 85, "Times New Roman", color_Equity_Account,14)。
Commen("nodepo",impracticable",1, 7, 85, "Times New Roman", color_Free,14)。
}
//---

如果(Orders_OK==false) order=1;
否则order=0。

如果(OrdersTotal()>=order)
{
for(int pos=OrdersTotal(); pos>=0; pos--)
{
如果(OrderSelect(pos,SELECT_BY_POS,MODE_TRADES))
{
如果(OrderSymbol()!=Symbol())继续。
{
SUMM= SUMM+OrderLots()。
SWAP=SWAP+OrderSwap()。
COMMIS=COMMIS+OrderCommission()。
OpenPrice=OpenPrice+OrderOpenPrice()。

//-------------------//Bay订单
如果(OrderType()==OP_BUY)
{
baylot= OrderLots()。
如果(baylot>=1 && baylot<99.0)
{
bSL1= bSL1+(OrderStopLoss())。
bTP1= bTP1+(OrderTakeProfit())。
bOPN1= bOPN1+(OrderOpenPrice();
如果(bSL1>0) bsumL1=bsumL1+1。
如果(bTP1>0) bsumP1=bsumP1+1。
如果(bOPN1>0) bsumO1=bsumO1+1。
}
如果(baylot>=0.1 && baylot<0.99)
{
bSL01= bSL01+(OrderStopLoss())。
bTP01= bTP01+(OrderTakeProfit())。
bOPN01= bOPN01+(OrderOpenPrice();
如果(bSL01>0) bsumL01=bsumL01+1。
如果(bTP01>0) bsumP01=bsumP01+1。
if(bOPN01>0) bsumO01=bsumO01+1;
}
} //OP_BUY

++++++++++++++++++++++++++++++++++++++++++++++++++ Пропуск кода

职能

void TRENDS(string name, int PER, int n, int X, int Y, color Lab_Trend_Bull, color Lab_Trend_Bear, color Lab_Trend_Doj, int rsm)
{
int A,B,a,b,cod;
双重Fup,Fdw;
double OPEN= iOpen(Symbol(),PER,1);
double CLOSE= iClose(Symbol(),PER,1);
double EMA21= iMA(Symbol(),PER,21,0,MODE_EMA,PRICE_CLOSE,1)。
double EMA89= iMA(Symbol(),PER,89,0,MODE_EMA,PRICE_CLOSE,1)。
字符串name2。
颜色_趋势。
bool FLEAT=false。

while(A<1)
{
double FUPPER= iFractals(Symbol(),PER,MODE_UPPER,a)。
if(FUPPER>0) { Fup=FUPPER; A++; }
a++;
}
while(B<1)
{
double FLOWER= iFractals(Symbol(),PER,MODE_LOWER,b)。
if(FLOWER>0) { Fdw=FLOWER; B++; }
b++;
}
如果((CLOSE>=OPEN && CLOSE<Fup) || (CLOSE<=OPEN && CLOSE>Fdw)
FLEAT=true。

如果(EMA21>EMA89 && FLEAT==true)
{ cod= 114; color_trend=Lab_Trend_Doj; name2="EMA21>eme89"; } // 公牛
否则
如果(EMA21<EMA89 && ((CLOSE>=OPEN && CLOSE>=Fup) || (CLOSE<=OPEN && CLOSE>=Fup))
{ cod=111; color_trend=Lab_Trend_Bull; name2="Fractal UPPER"; } // 公牛
否则
如果(EMA21>EMA89 && ((CLOSE>=OPEN && CLOSE>=Fup) || (CLOSE<=OPEN && CLOSE>=Fup))
{ cod=110; color_trend=Lab_Trend_Bull; name2="EMA21>ema89 + FRACTAL UPPER"; } // 公牛
否则
如果(EMA21<EMA89 && FLEAT==true)
{ cod= 113; color_trend=Lab_Trend_Doj; name2= "ema21<EMA89"; } // 熊
否则
如果(EMA21>EMA89 && ((CLOSE<=OPEN && CLOSE<=Fdw) || (CLOSE>=OPEN && CLOSE<=Fdw))
{ cod=111; color_trend=Lab_Trend_Bear; name2="Fractal LOWER"; } // 熊
否则
如果(EMA21<EMA89 && ((CLOSE<=OPEN && CLOSE<=Fdw) || (CLOSE>=OPEN && CLOSE<=Fdw))
{ cod= 110; color_trend=Lab_Trend_Bear; name2="ema21<EMA89 + FRACTAL LOWER"; } // 熊
否则
如果(EMA21==EMA89 || FLEAT==true)
{ cod= 110; color_trend=Lab_Trend_Doj; name2= "ema21==ema89 || Fractal"; } // doj

name=name+""+name2。
如果(PER==PERIOD_MN1) cod=111;
如果(cod==110)
{ rsm=rsm+3; X=X-1; Y=Y-3; }

ObjectCreate(name,OBJ_LABEL,0,0;)
ObjectSet(name,OBJPROP_CORNER,n)。
ObjectSet(name,OBJPROP_XDISTANCE,X)。
ObjectSet(name, OBJPROP_YDISTANCE,Y)。
ObjectSetText(name,CharToStr(cod), rsm, "Wingdings",color_trend);
}
void Commen(string name, string txt, int n, int X, int Y, string shrift, color clr, int rsm)
{
ObjectCreate(name,OBJ_LABEL,0,0,0);
ObjectSet(name,OBJPROP_CORNER,n)。
ObjectSet(name,OBJPROP_XDISTANCE,X)。
ObjectSet(name, OBJPROP_YDISTANCE,Y)。
ObjectSetText(name,txt, rsm,shrift,clr)。
}

+++++++++++++++++++++++++++++++++++++++++++ 和显示

 
nlp2311:

...

+++++++++++++++++++++++++++++++++++++++++++ 和输出


"+++++++++++++++++++++++++++++++++++++++++++ 和显示"

并学习如何正确插入代码。你的床单对任何人都不感兴趣......。

在这里 阅读整件事。

 
我忘记了我在Metatrader中的密码,我怎样才能创建一个新的密码,我可以联系谁?
 
Processor_ua:
我忘记了我在Metatrader上的密码,我如何创建一个新的密码?


如果你没有删除你的电子邮件,请参阅终端的标签 "邮箱"-注册一个新账户...

如果你已经删除,请联系你的经纪公司。