专家顾问 - 杂项问题 - 页 32 1...252627282930313233343536373839...43 新评论 Max Enrik 2017.02.06 17:45 #311 (在我写这篇评论之前,我想我为了找到解决方案而进行了疯狂的研究,是的,我找到了类似的主题,但我没有找到这个问题的解决方案。)我使用下面的代码来处理卖出订单,它显示了以点为单位的止损,它显示了正确的值,直到止损变成正值。 所以,我不知道该如何尝试解决这个问题。如果有什么好的意见,那就更好了,谢谢。(注意:我现在没有使用追踪止损。另外,下面的代码只是用于信息更新,不是用于OrderSend()或类似的东西。)if(OrderType()==OP_SELL || (OrderType()==OP_SELLLIMIT || OrderType()==OP_SELLSTOP)) { riskinpips=change_to_pips(OrderStopLoss()-OrderOpenPrice()); }Print("stop loss in pips",DoubleToString(riskinpips,2));谢谢你。(注:为了描述我的问题,用照片版程序制作的截图标签) Marco vd Heijden 2017.02.06 18:28 #312 它是最高值减去最低值后的结果,所以你可以检查 哪一个是最高值。if(OrderStopLoss()>OrderOpenPrice()) { // orderstoploss - orderopenprice }else if(OrderOpenPrice()>OrderStopLoss()) { // orderopenprice - orderstoploss } Max Enrik 2017.02.06 18:35 #313 Marco vd Heijden:它是用最高值减去最低值得出的结果,所以你可以检查哪一个是最高值。 if(OrderStopLoss()>OrderOpenPrice()) { // orderstoploss - orderopenprice }else if(OrderOpenPrice()>OrderStopLoss()) { // orderopenprice - orderstoploss }我只是笑着说我从来没有在意过。我想这可能对我有帮助。我很快就会尝试。谢谢你,马可先生。 Max Enrik 2017.02.06 23:05 #314 #盈利货币计算 - 关闭到目前为止,它工作得很完美。 非常感谢@Marco vd Heijden 和@whroeder1 Max Enrik 2017.02.09 02:27 #315 #时间 - 开放自从我开始为我的EA研究时间/时钟后。我看到作者在指标中使用start()。 我在EA中使用OnTimer()和OnTick(),我不想使用start()。 所以我只需要确定/了解哪种特殊功能 对时间和时钟功能更好?我将在10小时后继续研究这个问题。(注:我已经从Mql5.com Codebase页面找到了一些时间和时钟指标 - 但我不喜欢复制和粘贴)任何好的评论,论坛分享,以及链接和其他东西对我来说都是更好的。请提前感谢。 Marco vd Heijden 2017.02.09 09:18 #316 启动函数仅 在脚本中被OnStart 取代。在专家顾问和指标中,它应该分别改名为OnTick 和OnCalculate。在mql5程序操作中要执行的代码应该位于这三个函数中。见:https://www.mql5.com/en/docs/migration Documentation on MQL5: Moving from MQL4 www.mql5.com Moving from MQL4 - Reference on algorithmic/automated trading language for MetaTrader 5 Max Enrik 2017.02.09 10:33 #317 Marco vd Heijden:启动函数仅 在脚本中被OnStart 取代。在专家顾问和指标中,它应该分别改名为OnTick 和OnCalculate。在mql5程序操作中要执行的代码应该位于这三个函数中。 非常感谢@Marco,这对我来说太有意义了。我已经读过《从MQL4到MQL5》。 honest_knave 2017.02.09 10:49 #318 Max Enrik:#时间 - 开放自从我开始研究我的EA的时间/时钟。我看到作者在指标中使用start()。 我在我的EA中使用OnTimer()和OnTick(),我不希望使用start()。 所以我只需要确定/了解哪种特殊功能 对时间和时钟功能更好?我将在10小时后继续研究这个问题。(注:我已经从Mql5.com Codebase页面找到了一些时间和时钟指标 - 但我不喜欢复制和粘贴)任何好的评论,论坛分享,以及链接和其他东西对我来说都是更好的。提前感谢。使用OnTimer()。使用TimeLocal()会有一个更好的外观,但它不会与经纪人的时区同步。使用TimeCurrent()将与你的经纪人同步,但可能会滞后,然后 "跳 "秒,这取决于ticks何时到达。这个例子将强调这个问题。#property strictint OnInit() { EventSetTimer(1); return(INIT_SUCCEEDED); }void OnTimer() { Comment(StringFormat("%s - Local\n%s - Broker",TimeToString(TimeLocal(),TIME_SECONDS),TimeToString(TimeCurrent(),TIME_SECONDS))); } Max Enrik 2017.02.09 11:07 #319 #时间 - 关闭honest_knave:使用OnTimer()。 使用TimeLocal()会有一个更好的外观,但它不会与经纪人的时区同步。 使用TimeCurrent()将与你的经纪商同步,但可能会滞后,然后根据ticks到达的时间 "跳 "秒。这个例子将强调这个问题。#property strictint OnInit() { EventSetTimer(1); return(INIT_SUCCEEDED); }void OnTimer() { Comment(StringFormat("%s - Local\n%s - Broker",TimeToString(TimeLocal(),TIME_SECONDS),TimeToString(TimeCurrent(),TIME_SECONDS))); } 完全有用的评论。非常感谢,伙计。 Max Enrik 2017.02.09 11:53 #320 关于交易、自动交易系统和测试交易策略的论坛 专家顾问--杂七杂八的问题 honest_knave, 2016.11.30 01:28 IMHO,如果你把所有的手数计算放在一起,而不是在OnChartEvent()和_lotCalc()之间分割,会更好。一个检查最小/最大/步长并进行增量/减量的函数。void OnChartEvent(const int id , // Event ID const long & lparam , // Parameter of type long event const double & dparam , // Parameter of type double event const string & sparam // Parameter of type string events ){ _lotCalc(); //-------Process Button---------------------------------------------------------| if ( sparam == _btnLotMinus ) { ObjectSetInteger( 0, sparam, OBJPROP_STATE, false ); _lotSize = fmax(_lotMin, _lotSize-_lotStep); _calcUpdade( CALC_CHANGE_LOT ); printf( " | Lot: %.2f ", _lotSize ); return; } //---if Close // ...}void _lotCalc(){ //--- _lotMin = SymbolInfoDouble( _Symbol, SYMBOL_VOLUME_MIN ); _lotMax = SymbolInfoDouble( _Symbol, SYMBOL_VOLUME_MAX ); _lotStep = SymbolInfoDouble( _Symbol, SYMBOL_VOLUME_STEP ); //---}#Lot Step - ReOpen@honest_knave- 感谢你对手数大小和手数步骤的最大帮助。所以我只需要改进这部分代码,当 "手数>=(手数*100)"时,手数增加 "手数*100"。// lot plusif(sparam==lotbuttonplus) { if(lotsize>=(lotstep*100)) { lotstep=lotstep*100; Print("lot step: ",lotstep); } lotmaxdivide=lotmax/lotmax *(lotvalue*10); lotsize=fmin(lotmaxdivide,lotsize+(( ctrlfalse) ? lotstep*10 : lotstep));// global variable infoupdate(); printf("Lot: %.2f ",lotsize); ObjectSetInteger(0,sparam,OBJPROP_STATE,false); return; }提前感谢。 expert advisor - miscellaneous Adding, replacing, and removing Big Expert Advisor example 1...252627282930313233343536373839...43 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
(在我写这篇评论之前,我想我为了找到解决方案而进行了疯狂的研究,是的,我找到了类似的主题,但我没有找到这个问题的解决方案。)
我使用下面的代码来处理卖出订单,它显示了以点为单位的止损,它显示了正确的值,直到止损变成正值。
所以,我不知道该如何尝试解决这个问题。
如果有什么好的意见,那就更好了,谢谢。
(注意:我现在没有使用追踪止损。另外,下面的代码只是用于信息更新,不是用于OrderSend()或类似的东西。)
{
riskinpips=change_to_pips(OrderStopLoss()-OrderOpenPrice());
}
Print("stop loss in pips",DoubleToString(riskinpips,2));
谢谢你。
(注:为了描述我的问题,用照片版程序制作的截图标签)它是最高值减去最低值后的结果,所以你可以检查 哪一个是最高值。
{
// orderstoploss - orderopenprice
}
else if(OrderOpenPrice()>OrderStopLoss())
{
// orderopenprice - orderstoploss
}
它是用最高值减去最低值得出的结果,所以你可以检查哪一个是最高值。
{
// orderstoploss - orderopenprice
}
else if(OrderOpenPrice()>OrderStopLoss())
{
// orderopenprice - orderstoploss
}
我只是笑着说我从来没有在意过。我想这可能对我有帮助。我很快就会尝试。
谢谢你,马可先生。
#盈利货币计算 - 关闭
到目前为止,它工作得很完美。
非常感谢@Marco vd Heijden 和@whroeder1
#时间 - 开放
自从我开始为我的EA研究时间/时钟后。我看到作者在指标中使用start()。
我在EA中使用OnTimer()和OnTick(),我不想使用start()。
所以我只需要确定/了解哪种特殊功能 对时间和时钟功能更好?
我将在10小时后继续研究这个问题。
(注:我已经从Mql5.com Codebase页面找到了一些时间和时钟指标 - 但我不喜欢复制和粘贴)
任何好的评论,论坛分享,以及链接和其他东西对我来说都是更好的。
请提前感谢。
启动函数仅 在脚本中被OnStart 取代。在专家顾问和指标中,它应该分别改名为OnTick 和OnCalculate。在mql5程序操作中要执行的代码应该位于这三个函数中。
见:https://www.mql5.com/en/docs/migration
启动函数仅 在脚本中被OnStart 取代。在专家顾问和指标中,它应该分别改名为OnTick 和OnCalculate。在mql5程序操作中要执行的代码应该位于这三个函数中。
#时间 - 开放
自从我开始研究我的EA的时间/时钟。我看到作者在指标中使用start()。
我在我的EA中使用OnTimer()和OnTick(),我不希望使用start()。
所以我只需要确定/了解哪种特殊功能 对时间和时钟功能更好?
我将在10小时后继续研究这个问题。
(注:我已经从Mql5.com Codebase页面找到了一些时间和时钟指标 - 但我不喜欢复制和粘贴)
任何好的评论,论坛分享,以及链接和其他东西对我来说都是更好的。
提前感谢。
使用OnTimer()。
使用TimeLocal()会有一个更好的外观,但它不会与经纪人的时区同步。
使用TimeCurrent()将与你的经纪人同步,但可能会滞后,然后 "跳 "秒,这取决于ticks何时到达。这个例子将强调这个问题。
int OnInit()
{
EventSetTimer(1);
return(INIT_SUCCEEDED);
}
void OnTimer()
{
Comment(StringFormat("%s - Local\n%s - Broker",TimeToString(TimeLocal(),TIME_SECONDS),TimeToString(TimeCurrent(),TIME_SECONDS)));
}
#时间 - 关闭
使用OnTimer()。
使用TimeLocal()会有一个更好的外观,但它不会与经纪人的时区同步。
使用TimeCurrent()将与你的经纪商同步,但可能会滞后,然后根据ticks到达的时间 "跳 "秒。这个例子将强调这个问题。
int OnInit()
{
EventSetTimer(1);
return(INIT_SUCCEEDED);
}
void OnTimer()
{
Comment(StringFormat("%s - Local\n%s - Broker",TimeToString(TimeLocal(),TIME_SECONDS),TimeToString(TimeCurrent(),TIME_SECONDS)));
}
关于交易、自动交易系统和测试交易策略的论坛
专家顾问--杂七杂八的问题
honest_knave, 2016.11.30 01:28
IMHO,如果你把所有的手数计算放在一起,而不是在OnChartEvent()和_lotCalc()之间分割,会更好。一个检查最小/最大/步长并进行增量/减量的函数。
const long & lparam , // Parameter of type long event
const double & dparam , // Parameter of type double event
const string & sparam // Parameter of type string events
)
{
_lotCalc();
//-------Process Button---------------------------------------------------------|
if ( sparam == _btnLotMinus )
{
ObjectSetInteger( 0, sparam, OBJPROP_STATE, false );
_lotSize = fmax(_lotMin, _lotSize-_lotStep);
_calcUpdade( CALC_CHANGE_LOT );
printf( " | Lot: %.2f ", _lotSize );
return;
} //---if Close
// ...
}
void _lotCalc()
{
//---
_lotMin = SymbolInfoDouble( _Symbol, SYMBOL_VOLUME_MIN );
_lotMax = SymbolInfoDouble( _Symbol, SYMBOL_VOLUME_MAX );
_lotStep = SymbolInfoDouble( _Symbol, SYMBOL_VOLUME_STEP );
//---
}
#Lot Step - ReOpen
@honest_knave- 感谢你对手数大小和手数步骤的最大帮助。
所以我只需要改进这部分代码,当 "手数>=(手数*100)"时,手数增加 "手数*100"。
if(sparam==lotbuttonplus)
{
if(lotsize>=(lotstep*100))
{
lotstep=lotstep*100;
Print("lot step: ",lotstep);
}
lotmaxdivide=lotmax/lotmax *(lotvalue*10);
lotsize=fmin(lotmaxdivide,lotsize+(( ctrlfalse) ? lotstep*10 : lotstep));
// global variable
infoupdate();
printf("Lot: %.2f ",lotsize);
ObjectSetInteger(0,sparam,OBJPROP_STATE,false);
return;
}
提前感谢。