任何菜鸟问题,为了不给论坛添乱。专业人士,不要路过。没有你就无处可去 - 6. - 页 838

 
VOLDEMAR:

不能把设计放在一起

它一直在骂人

在一天中,我必须要得到索引


int类型的ENUM_DAY_OF_WEEK
 
evillive:
ENUM_DAY_OF_WEEK是int类型。
我已经试过int和string以及double
 
evillive:
你不能手动操作,终端只有在你使用程序交易时才会画出这些图标。或者,你可以将手动交易历史复制到图表上,所有的交易都会被标记。

如果你用这种方式修改每个未平仓订单的颜色,交易是否会反映在图表上?

int i2;  

    for (i2=OrdersTotal()-1; i2>=0; i--){

    if (OrderSelect(i2, SELECT_BY_POS, MODE_TRADES)){

      if (OrderSymbol()==Symbol()){  

       if (OrderType()==OP_SELL){

        c=OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),OrderTakeProfit(),0,Red);

       }

       if (OrderType()==OP_BUY){   

        c=OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),OrderTakeProfit(),0,Green);

       }

      }

     }

    }

   }

 

决定在运行可视化时将余额作为一个指标来显示

Balance=AccountBalance();
double price=iCustom(NULL,0,"AccountBalance",Balance,0,1);

从指标上看。

#property indicator_separate_window
#property indicator_buffers 1
#property  indicator_color1  Blue       
//--- input parameters
//--- buffers
extern double       Balance=3;
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(1);
   SetIndexBuffer(0,ExtMapBuffer1);
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted(),
   i,limit1;
   limit1=Bars-counted_bars-1;

   for(i=limit1;i>=0;i--)ExtMapBuffer1[i]=Balance;
   
   return(0);
  }
//+------------------------------------------------------------------+

而且调用得太频繁了)它使屏幕变白。这个问题是反问句,有什么问题吗?

 
Forexman77:

决定在运行可视化时将余额作为一个指标来显示

从指标上看。

而且调用得太频繁了)它使屏幕变白。这个问题是反问句,什么是错的?

bool balans。

string balans_S;

///////////////////////////////////////////////////////////////////////////////////////////////////
balans_S=DoubleToStr(AccountBalance(),2)+"" +AccountCurrency()。
balans=ObjectCreate("平衡",OBJ_LABEL, 0, 0, 0)。
balans=ObjectSetText("平衡",balans_S, 14, "Arial", Orange)。
balans=ObjectSet("平衡", OBJPROP_CORNER, 1)。
balans=ObjectSet("平衡", OBJPROP_XDISTANCE, 20)。
balans=ObjectSet("平衡", OBJPROP_YDISTANCE, 20)。

///////////////////////////////////////////////////////////////////////////////////////////////////

在你的专家顾问中插入这段代码,幸福可能会降临到你身上

 
woin2110:

bool balans。

string balans_S;

///////////////////////////////////////////////////////////////////////////////////////////////////
balans_S=DoubleToStr(AccountBalance(),2)+"" +AccountCurrency()。
balans=ObjectCreate("平衡", OBJ_LABEL, 0, 0, 0)。
balans=ObjectSetText("平衡",balans_S, 14, "Arial", Orange)。
balans=ObjectSet("平衡", OBJPROP_CORNER, 1)。
balans=ObjectSet("平衡", OBJPROP_XDISTANCE, 20)。
balans=ObjectSet("平衡", OBJPROP_YDISTANCE, 20)。

///////////////////////////////////////////////////////////////////////////////////////////////////

在你的专家顾问中插入这段代码,幸福可能会降临到你身上

谢谢你。但是,我需要将余额显示为一条线,显示在整个图表部分。
 
evillive:
奇怪的是,它对我来说是有效的。也许日志文件中存在错误?

我想明白了,我错误地将模板的名字Debug.tpl与专家连接起来保存,所以在模板文件的末尾有一个额外的指令。

<expert>
name=ProbaExpert
flags=275
window_num=0
<inputs>
StrPeriod_Direct=
Pips=50
</inputs>
</expert>

在没有专家的情况下保存了模板,一切正常,谢谢。

 
for(int i=0;i<OrdersHistoryTotal(); i++)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
        {  
         if(OrderType()==OP_SELL)
          {  
           if(OrderStopLoss()>OrderOpenPrice())
            {                     
              if(OrdersTotal() == 0)
              {              
               double SELLprice=Bid;  
               int ticket =OrderSend(Symbol(), OP_SELL,Lot*=2,SELLprice, 3,SELLprice+StopLoss* Point, 0, "", MagicNumber,0, clrNONE);
                 
              }
            }            
          }              
        }
     }     

请建议,我想让我的代码在交易亏损的情况下增加LOT,而在交易盈利的情况下,LOT返回到原来的量!

 

为了在可视化中以线的形式显示余额,我们采用了文章中的代码。

在EA。

// сохранение последнего значения баланса в гл. переменную
   GlobalVariableSet( "vGrafBalance", AccountBalance() );

在指标中。

#property indicator_separate_window
#property indicator_buffers 1
#property  indicator_color1 Blue
 
double balance[];
 
int init()
{
    IndicatorShortName( "vGrafBalance" );
    IndicatorDigits( 2 );
 
    SetIndexStyle( 0, DRAW_LINE );
    SetIndexBuffer( 0, balance );
    SetIndexLabel( 0, "Balance" );
}
int start()
{
    balance[0] = GlobalVariableGet( "vGrafBalance" );
    return(0);
}

这条线没有出现。最后只有缓冲区内的最后一个零条上有一个值。

 
Forexman77:

为了在可视化中以线的形式显示余额,我们采用了文章中的代码。

在EA。

在指标中。

这条线没有出现。最后只有缓冲区内的最后一个零条上有一个值。

要在所有的条形图上显示,你需要计算所有的条形图,就像通常在指标中做的那样。
原因: