Experts: Cidomo - page 2

 

Next is the code:

//--- check Freeze and Stops levels
/*
 Type of order/position | Activation price | Check
 ------------------------|--------------------|--------------------------------------------
 Buy Limit order| Ask| Ask-OpenPrice >= SYMBOL_TRADE_FREEZE_LEVEL
 Buy Stop order| Ask| OpenPrice-Ask >= SYMBOL_TRADE_FREEZE_LEVEL
 Sell Limit order | Bid| OpenPrice-Bid >= SYMBOL_TRADE_FREEZE_LEVEL
 Sell Stop order| Bid |Bid-OpenPrice >= SYMBOL_TRADE_FREEZE_LEVEL
 Buy position| Bid| TakeProfit-Bid >= SYMBOL_TRADE_FREEZE_LEVEL 
 || Bid-StopLoss >= SYMBOL_TRADE_FREEZE_LEVEL
 Sell position| Ask| Ask-TakeProfit >= SYMBOL_TRADE_FREEZE_LEVEL
 | |StopLoss-Ask >= SYMBOL_TRADE_FREEZE_LEVEL
 
 Buying is done at the Ask price| Selling is done at the Bid price
 ------------------------------------------------|----------------------------------
 TakeProfit >= Bid| TakeProfit<= Ask
 StopLoss<= Bid| StopLoss>= Ask
 TakeProfit - Bid >= SYMBOL_TRADE_STOPS_LEVEL |Ask - TakeProfit >= SYMBOL_TRADE_STOPS_LEVEL
 Bid - StopLoss >= SYMBOL_TRADE_STOPS_LEVEL | StopLoss - Ask >= SYMBOL_TRADE_STOPS_LEVEL
*/
   if(!RefreshRates() || !m_symbol.Refresh())
     {
      PrevBars=0;
      return;
     }
//--- FreezeLevel -> for pending order and modification
   double freeze_level=m_symbol.FreezeLevel()*m_symbol.Point();
   if(freeze_level==0.0)
      freeze_level=(m_symbol.Ask()-m_symbol.Bid())*3.0;
   freeze_level*=1.1;

The calculations are not clear here:

freeze_level=(m_symbol.Ask()-m_symbol.Bid())*3.0;

freeze_level*=1.1;

For what purpose? And why multiply *3.0 and *=1.1.

 
Sysmart:

The following is the code:

The calculations here are not clear:

freeze_level=(m_symbol.Ask()-m_symbol.Bid())*3.0;

freeze_level*=1.1;

For what purpose. And why multiply *3.0 and *=1.1.

The main task is to cut off scalpers and pipsetters.

 

The OnTradeTransaction function is very mysterious to me, if possible, please explain in as much detail as possible what is going on here:

void OnTradeTransaction(const MqlTradeTransaction &trans,
                        const MqlTradeRequest &request,
                        const MqlTradeResult &result)
  {
//--- get transaction type as enumeration value 
   ENUM_TRADE_TRANSACTION_TYPE type=trans.type;
//--- if transaction is the result of addition of the transaction in history
   if(type==TRADE_TRANSACTION_DEAL_ADD)
     {
      long     deal_ticket       =0;
      long     deal_order        =0;
      long     deal_time         =0;
      long     deal_time_msc     =0;
      long     deal_type         =-1;
      long     deal_entry        =-1;
      long     deal_magic        =0;
      long     deal_reason       =-1;
      long     deal_position_id  =0;
      double   deal_volume       =0.0;
      double   deal_price        =0.0;
      double   deal_commission   =0.0;
      double   deal_swap         =0.0;
      double   deal_profit       =0.0;
      string   deal_symbol       ="";
      string   deal_comment      ="";
      string   deal_external_id  ="";
      if(HistoryDealSelect(trans.deal))
        {
         deal_ticket       =HistoryDealGetInteger(trans.deal,DEAL_TICKET);
         deal_order        =HistoryDealGetInteger(trans.deal,DEAL_ORDER);
         deal_time         =HistoryDealGetInteger(trans.deal,DEAL_TIME);
         deal_time_msc     =HistoryDealGetInteger(trans.deal,DEAL_TIME_MSC);
         deal_type         =HistoryDealGetInteger(trans.deal,DEAL_TYPE);
         deal_entry        =HistoryDealGetInteger(trans.deal,DEAL_ENTRY);
         deal_magic        =HistoryDealGetInteger(trans.deal,DEAL_MAGIC);
         deal_reason       =HistoryDealGetInteger(trans.deal,DEAL_REASON);
         deal_position_id  =HistoryDealGetInteger(trans.deal,DEAL_POSITION_ID);

         deal_volume       =HistoryDealGetDouble(trans.deal,DEAL_VOLUME);
         deal_price        =HistoryDealGetDouble(trans.deal,DEAL_PRICE);
         deal_commission   =HistoryDealGetDouble(trans.deal,DEAL_COMMISSION);
         deal_swap         =HistoryDealGetDouble(trans.deal,DEAL_SWAP);
         deal_profit       =HistoryDealGetDouble(trans.deal,DEAL_PROFIT);

         deal_symbol       =HistoryDealGetString(trans.deal,DEAL_SYMBOL);
         deal_comment      =HistoryDealGetString(trans.deal,DEAL_COMMENT);
         deal_external_id  =HistoryDealGetString(trans.deal,DEAL_EXTERNAL_ID);
        }
      else
         return;
      if(deal_symbol==m_symbol.Name() && deal_magic==m_magic)
         if(deal_entry==DEAL_ENTRY_IN)
            if(deal_type==DEAL_TYPE_BUY || deal_type==DEAL_TYPE_SELL)
              {
               m_need_delete_buy_stop  = true;
               m_need_delete_sell_stop = true;
              }
     }
  }
 

In the expression:

      double tp=(InpTakeProfit==0)?0.0:price+ExtTakeProfit;
      if(tp!=0.0 && ExtTakeProfit<level) // check price
         tp=price+ExtTakeProfit;

I think there is a mistake, it should be: tp=price+level;

 

hello my freind thank you for the ea, i try it in the demo and its work fine, open and make pinding orders.


But when i try to use in live account.  its get rejected from doing that. any idea to help please with that i want to try it in real account.


with my thanks 

 
Mazyad AlAdwani :

hello my freind thank you for the ea, i try it in the demo and its work fine, open and make pinding orders.


But when i try to use in live account.  its get rejected from doing that. any idea to help please with that i want to try it in real account .


with my thanks 

Unfortunately, I cannot read minds from a distance. Also, a full-time telepath is on vacation. Therefore: provide such data (and it is good practice to provide technical data on a technical resource)

  • currency and balance of the trading account
  • advisor settings
  • log file (from the Experts tab and the Journal tab)
 
Vladimir Karputov:

Unfortunately, I cannot read minds from a distance. Also, a full-time telepath is on vacation. Therefore: provide such data (and it is good practice to provide technical data on a technical resource)

  • currency and balance of the trading account
  • advisor settings
  • log file (from the Experts tab and the Journal tab)
  • currency and balance of the trading account
  •  GPBUSD - 80 $


  • advisor settings


  • log file (from the Experts tab and the Journal tab)  

thank you in advance , and sorry not to put all that from the first i am new to all that, but learning,.



 

hi again, i waited to you to fix my problem with the EA. i want to use it in live account, any new news ?

 
Mazyad AlAdwani :

hi again, i waited to you to fix my problem with the EA. i want to use it in live account, any new news ?

Learn to read first. Here is a technical forum and if you are asked to perform some actions - you must perform these actions.


Forum on trading, automated trading systems and testing trading strategies

Experts: Cidomo

Vladimir Karputov, 2020.06.03 05:08

Unfortunately, I cannot read minds from a distance. Also, a full-time telepath is on vacation. Therefore: provide such data (and it is good practice to provide technical data on a technical resource)

  • currency and balance of the trading account
  • advisor settings
  • log file (from the Experts tab and the Journal tab)

 
Vladimir Karputov:

Learn to read first. Here is a technical forum and if you are asked to perform some actions - you must perform these actions.



sorry . i send image in the first reply but i did not notice they are deleted !


anyway i make video for that you can see it