如何编码? - 页 2

 
cardio:

请告诉我如何发布代码--使其进入一个其他人可以轻松复制的方框。

谢谢

你可以将代码作为简单的文本发布。

但最好是像这样在推特上发布这个符号#。

This is the code
 

测试

一些代码。

void MoneyManagement()

{

int i,hstTotal=HistoryTotal();

int losses;

static double val1;

for(i=hstTotal-1;i>=0;i--)

{

//---- check selection result

if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==fals e)

{

Print("Access to history failed with error (",GetLastError(),")");

break;

}

if(OrderProfit()>0){

val1 = 0;

break;

}

if(OrderProfit()<0) {

losses++;

val1 = val1 + orderProfit();

}

if(losses==2) {

lotMM = MathCeil(AccountFreeMargin() * 50 / 10000) / 10; // 50 risk

if (lotMM < 0.1) lotMM = Lots;

if (lotMM > 1.0) lotMM = MathCeil(lotMM);

if (lotMM > 100) lotMM = 100;

}

}

找到了 - 谢谢 - 在这个论坛上可以找到不同的HTML标签吗?

 

vB代码

cardio:
在这个论坛上,你能找到不同的HTML标签吗?

遵循这个链接vB代码

 

谢谢

谢谢代码大师

 

零损失代码?

你好。

请帮助我这个新手!

谁能写出代码(MQL4),在利润达到X点后修改订单的止损?我想把这段代码纳入一个EA。我想把止损提高到0利润的水平,以便在市场对我的头寸不利时不损失任何东西。这样头寸就会以0P/L的价格关闭。当你的头寸只赚了几个点(不足以触发追踪止损),之后价格向相反的方向发展,使你亏损时,这非常有用。

谢谢你。

 

你好。

我不确定这是否可以整合到你的EA中,但我放了一个单独的功能,你可以把它放在代码的最后,在主循环中调用。

请确保你有一个全局变量 "Magic",在下单时使用。

----

int Magic;

-----

此外,你需要设置利润的点数 "ProfitModifySL",然后再将你的止损设置为实际开盘价。

----

extern double ProfitModifySL=15; // 在进入15个点的利润后,止损被调整到订单的开盘价。

-----

//+------------------------------------------------------------------+

//|扫描订单,如果处于盈利状态,由ParmSL修改SL。

//+------------------------------------------------------------------+

空白 fModifySLWhenInProfit()

{

for (int i=0; i<OrdersTotal(); i++)

{

如果(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)

{

如果(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)

{

如果(OrderType()==OP_BUY && Bid-OrderOpenPrice()>=ProfitModifySL*Point)

fModifyStopLoss(OrderOpenPrice())。

如果(OrderType()==OP_SELL && OrderOpenPrice()-Ask>=ProfitModifySL*Point)

fModifyStopLoss(OrderOpenPrice())。

}

}

}

}

//+------------------------------------------------------------------+

//|修改止损|

//+------------------------------------------------------------------+

void fModifyStopLoss(double tStopLoss)

{

bool result = OrderModify(OrderTicket(),OrderOpenPrice(),tStopLoss,OrderTakeProfit(),0,NULL) 。

}

否则我在帖子中附上了一个简单的EA,可以做到这一点。

希望这对你有帮助

谢谢

附加的文件:
sample-v1.mq4  4 kb
 

谢谢你,sunwest!

 

不客气,也是为了避免一直修改你的订单,一旦你可以改变就做。

如果(OrderType()==OP_BUY && Bid-OrderOpenPrice()>=ProfitModifySL*Point)

fModifyStopLoss(OrderOpenPrice())。

如果(OrderType()==OP_SELL && OrderOpenPrice()-Ask>=ProfitModifySL*Point)

fModifyStopLoss(OrderOpenPrice())。

如果(OrderType()==OP_BUY && Bid-OrderOpenPrice()>=ProfitModifySL*Point)

如果(OrderStopLoss()<OrderOpenPrice()) fModifyStopLoss(OrderOpenPrice()) 。

如果(OrderType()==OP_SELL && OrderOpenPrice()-Ask>=ProfitModifySL*Point)

如果(OrderStopLoss()>OrderOpenPrice()) fModifyStopLoss(OrderOpenPrice())。

S.

 

mql代码中的垂直生产线 生产

大家好。

我对一个mql代码集感兴趣,它可以在一个可选择的时间在图表上产生一条垂直线。是否有这样的东西存在,或者它可以被编码呢?

我对mql代码的理解非常少,而且我不能编码任何东西。我所能做的就是改变 "对象 "的颜色和它们的密度。

我感谢所有回应的人,感谢这个美好的论坛......

祝大家交易顺利.......................

 

类似的船

我也遇到了同样的问题......但我不希望有一条线(更杂乱),而是希望有一个彩色的蜡烛......同样,它需要用户输入,这样我们就可以显示各种市场的开盘情况......作为一个例子。

姜文