Download MetaTrader 5

Examples: The Basic of Coding A Hedge Expert Advisor

To add comments, please log in or register
MetaQuotes Software Corp.
Moderator
192482
MetaQuotes Software Corp.  

New article The Basic of Coding A Hedge Expert Advisor has been published:

An example of hedge Expert Advisor is just presented in this article. The author will choose its very own favorite hedge pair that is EURJPY & GBPJPY. It always moves the same way, easier to set the hedging order type.

Author: chayutra sriboonruang

Sart
26
Sart  
else // in case ping failed or requote 
          { 
            if(ExistPositions(BaseSymbol, MagicNo) == 1&&
               TotalCurProfit(MagicNo)>AcceptableLoss$) -------------------> ЗДЕСЬ
              { 
                CloseScrap(BaseSymbol, ExistOP(BaseSymbol, 
                           MagicNo), MagicNo); 
              } 
            else 
                if(ExistPositions(H_Symbol, MagicNo) == 1&&
                   TotalCurProfit(MagicNo) > AcceptableLoss$) ----------------------> И ЗДЕСЬ
                  { 
                    CloseScrap(H_Symbol, ExistOP(H_Symbol, 
                               MagicNo), MagicNo); 
                  } 
          } 
 
Эти условия всегда будут справедливы, а позиции будут сразу закрываться после открытия...
This conditions are always true, so orders would be closed just after opening.
With Regartds - S,D.
baal79
44
baal79  
{ return(true);                    -- ? Return before next commands. PlaySound don't work never.
  if(PlayAudio) {PlaySound ... ;}   
}
Lukasz Starczewski
150
Lukasz Starczewski  
I get "No Swap Condition To Gain From : pls modify one or more input parameter(s)". What is causing that? How to make it work?
Silverthorn
21
Silverthorn  
I am having a problem with sending the hedge using this method. The base symbol is opening OK but the Hedge is giving an Invalid Price error. Any ideas????
Daniel Castro
90
Daniel Castro  
What is the point in having a code that is not backtestable?
To add comments, please log in or register