EA: 返回策略

 

返回策略:

使用限价买入和限价卖出挂单。 挂单网格。

返回策略

作者: Vladimir Karputov

 
Alexander Kamyshanov:
您好,如何使挂单在 数分钟内以一定的点数落后于价格,而不是在挂单 有效期内以一定的点数落后于价格?

首先: 您需要至少通过 Word 运行问题文本 - 此操作将纠正文本并在正确的地方添加标点符号 ...

 

版本 1.001 - 修正LotsOrRisk 功能

您可以从Return Strategy 下载

 

嗨,弗拉基米尔,
感谢您的更正。

我们是否可以说,总利润函数(以点为单位)与目标利润或最低利润的功能不一样?

 
Edviao:

嗨,弗拉基米尔,
感谢您的更正。

我们是否可以说,总利润函数(以点为单位)与目标利润或最低利润的功能不一样?

问题不清楚:EA 中没有"目标利润"和"最低利润"。


如何寻找答案:输入参数 "总利润(以点为单位)"--看看是哪个变量造成的

input ushort   InpTotalProfit    = 100;      // 总利润(点数)


...查找首次出现的"InpTotalProfit"。

   ExtTotalProfit    = InpTotalProfit  * m_adjusted_point;


...现在查找首次出现的"ExtTotalProfit"...

//---
   if(CalculateTotalProfit()>=ExtTotalProfit)
     {
      bln_close_all=true;
      return;
     }


...剩下的就是研究 "CalculateTotalProfit() "函数了...

 
弗拉基米尔,谢谢你给我布置的家庭作业,我这周末就去做!
 

下午好!

测试过程中日志中出现信息的原因是什么?Expert Advisor 的设置默认设置

2021.10.30 10:20:44.968 2021.01.11 10:57:26   Code of request result: 10022
2021.10.30 10:20:44.968 2021.01.11 10:57:26   code of request result as a string: invalid expiration
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Deal ticket: 0
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Order ticket: 0
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Volume of deal or order: 0.00
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Price, confirmed by broker: 0.00000
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Current bid price: 1.21783 (the requote): 0.00000
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Current ask price: 1.21795 (the requote): 0.00000
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Broker comment: 
2021.10.30 10:20:44.968 2021.01.11 10:57:26   CTrade::OrderOpen: Invalid expiration type
2021.10.30 10:20:44.968 2021.01.11 10:57:26   #3  Buy Limit (0) -> false. Result Retcode: 10022, description of result: invalid expiration
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Code of request result: 10022
2021.10.30 10:20:44.968 2021.01.11 10:57:26   code of request result as a string: invalid expiration
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Deal ticket: 0
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Order ticket: 0
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Volume of deal or order: 0.00
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Price, confirmed by broker: 0.00000
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Current bid price: 1.21782 (the requote): 0.00000
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Current ask price: 1.21794 (the requote): 0.00000
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Broker comment: 
2021.10.30 10:20:44.968 2021.01.11 10:57:26   CTrade::OrderOpen: Invalid expiration type
2021.10.30 10:20:44.968 2021.01.11 10:57:26   #3  Buy Limit (1) -> false. Result Retcode: 10022, description of result: invalid expiration
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Code of request result: 10022
2021.10.30 10:20:44.968 2021.01.11 10:57:26   code of request result as a string: invalid expiration
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Deal ticket: 0
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Order ticket: 0
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Volume of deal or order: 0.00
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Price, confirmed by broker: 0.00000
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Current bid price: 1.21782 (the requote): 0.00000
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Current ask price: 1.21794 (the requote): 0.00000
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Broker comment: 
2021.10.30 10:20:44.968 2021.01.11 10:57:26   CTrade::OrderOpen: Invalid expiration type
2021.10.30 10:20:44.968 2021.01.11 10:57:26   #3  Buy Limit (2) -> false. Result Retcode: 10022, description of result: invalid expiration
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Code of request result: 10022
2021.10.30 10:20:44.968 2021.01.11 10:57:26   code of request result as a string: invalid expiration
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Deal ticket: 0
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Order ticket: 0
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Volume of deal or order: 0.00
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Price, confirmed by broker: 0.00000
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Current bid price: 1.21782 (the requote): 0.00000
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Current ask price: 1.21794 (the requote): 0.00000
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Broker comment: 
2021.10.30 10:20:44.968 2021.01.11 10:57:26   CTrade::OrderOpen: Invalid expiration type
2021.10.30 10:20:44.968 2021.01.11 10:57:26   #3  Buy Limit (3) -> false. Result Retcode: 10022, description of result: invalid expiration
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Code of request result: 10022
2021.10.30 10:20:44.968 2021.01.11 10:57:26   code of request result as a string: invalid expiration
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Deal ticket: 0
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Order ticket: 0
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Volume of deal or order: 0.00
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Price, confirmed by broker: 0.00000
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Current bid price: 1.21782 (the requote): 0.00000
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Current ask price: 1.21794 (the requote): 0.00000
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Broker comment: 
2021.10.30 10:20:44.968 2021.01.11 10:57:26   CTrade::OrderOpen: Invalid expiration type
2021.10.30 10:20:44.968 2021.01.11 10:57:26   #3  Sell Limit (0) -> false. Result Retcode: 10022, description of result: invalid expiration
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Code of request result: 10022
2021.10.30 10:20:44.968 2021.01.11 10:57:26   code of request result as a string: invalid expiration
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Deal ticket: 0
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Order ticket: 0
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Volume of deal or order: 0.00
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Price, confirmed by broker: 0.00000
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Current bid price: 1.21782 (the requote): 0.00000
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Current ask price: 1.21794 (the requote): 0.00000
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Broker comment: 
2021.10.30 10:20:44.968 2021.01.11 10:57:26   CTrade::OrderOpen: Invalid expiration type
2021.10.30 10:20:44.968 2021.01.11 10:57:26   #3  Sell Limit (1) -> false. Result Retcode: 10022, description of result: invalid expiration
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Code of request result: 10022
2021.10.30 10:20:44.968 2021.01.11 10:57:26   code of request result as a string: invalid expiration
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Deal ticket: 0
2021.10.30 10:20:44.968 2021.01.11 10:57:26   Order ticket: 0
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Volume of deal or order: 0.00
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Price, confirmed by broker: 0.00000
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Current bid price: 1.21782 (the requote): 0.00000
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Current ask price: 1.21794 (the requote): 0.00000
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Broker comment: 
2021.10.30 10:20:44.969 2021.01.11 10:57:26   CTrade::OrderOpen: Invalid expiration type
2021.10.30 10:20:44.969 2021.01.11 10:57:26   #3  Sell Limit (2) -> false. Result Retcode: 10022, description of result: invalid expiration
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Code of request result: 10022
2021.10.30 10:20:44.969 2021.01.11 10:57:26   code of request result as a string: invalid expiration
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Deal ticket: 0
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Order ticket: 0
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Volume of deal or order: 0.00
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Price, confirmed by broker: 0.00000
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Current bid price: 1.21782 (the requote): 0.00000
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Current ask price: 1.21794 (the requote): 0.00000
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Broker comment: 
2021.10.30 10:20:44.969 2021.01.11 10:57:26   CTrade::OrderOpen: Invalid expiration type
2021.10.30 10:20:44.969 2021.01.11 10:57:26   #3  Sell Limit (3) -> false. Result Retcode: 10022, description of result: invalid expiration
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Code of request result: 10022
2021.10.30 10:20:44.969 2021.01.11 10:57:26   code of request result as a string: invalid expiration
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Deal ticket: 0
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Order ticket: 0
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Volume of deal or order: 0.00
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Price, confirmed by broker: 0.00000
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Current bid price: 1.21782 (the requote): 0.00000
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Current ask price: 1.21794 (the requote): 0.00000
2021.10.30 10:20:44.969 2021.01.11 10:57:26   Broker comment: 

弗拉基米尔

 
表示不支持"ORDER_TIME_SPECIFIED"。
 
Vladimir Karputov "ORDER_TIME_SPECIFIED"。

我不好意思问--不支持的是谁或什么?

敬上,弗拉基米尔。

 
MrBrooklin #:

我不好意思问--没有得到谁的支持,还是什么?

恕我直言,弗拉基米尔

交易服务器。您不会是在测试外汇吧?

 
Vladimir Karputov #:

交易服务器。您可能不是在测试外汇交易吗?

我正在我的外汇交易商终端上进行测试。我会尝试更新版本。

再见,弗拉基米尔。