Рейтинг: Empty Star Empty Star Empty Star Empty Star Empty Star
CloseAllAtEquityLevel
Предыдущий 1 2 Следующий
carlosforex

Пользователь с Apr 17, 2012  7 сообщений carlosforex May 03 2012 at 17:12
Does anyone know how to use this Expert?

Can you help me?

Raiden

Пользователь с Nov 27, 2010  243 сообщений www.raidenworks.com (Raiden) May 04 2012 at 02:46
More specifics would help.

By the title, it also sounds more like a trade management EA. Steve Hopwood wrote an excellent Multi Purpose Trade Management EA (MPTM). Read its documentation, it'd probably do what you want.

That said:

extern bool EquityStopLoss = TRUE;
extern double EquityPercent = 10.0; //for 10% drawdown

int start(){
   if(EquityStopLoss&&1-AccountEquity()/AccountBalance()>EquityPercent/100){ //if drawdown exceeds 10%
   CloseAll(); //Close all trades
   }
}

void CloseAll(){ //Close all BUY and SELL orders including Pending Orders if any
   bool result=false;
   for(int i=OrdersTotal()-1;i>=0;i--){
      OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if(OrderSymbol()==Symbol()&&OrderMagicNumber()==Magic)result=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),MaxSlippage*mt,Blue);
      if(result==false){
         Print('CloseAll failed with error#',GetLastError());
         continue;
      }
   }
}

Consistency above all.
carlosforex

Пользователь с Apr 17, 2012  7 сообщений carlosforex May 10 2012 at 18:37

   Raiden posted:
   More specifics would help.

By the title, it also sounds more like a trade management EA. Steve Hopwood wrote an excellent Multi Purpose Trade Management EA (MPTM). Read its documentation, it'd probably do what you want.

That said:

extern bool EquityStopLoss = TRUE;
extern double EquityPercent = 10.0; //for 10% drawdown

int start(){
   if(EquityStopLoss&&1-AccountEquity()/AccountBalance()>EquityPercent/100){ //if drawdown exceeds 10%
   CloseAll(); //Close all trades
   }
}

void CloseAll(){ //Close all BUY and SELL orders including Pending Orders if any
   bool result=false;
   for(int i=OrdersTotal()-1;i>=0;i--){
      OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if(OrderSymbol()==Symbol()&&OrderMagicNumber()==Magic)result=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),MaxSlippage*mt,Blue);
      if(result==false){
         Print('CloseAll failed with error#',GetLastError());
         continue;
      }
   }
}






Thank you for the answer!

I dont know much about Metaquotes... How can I change the percentage?
If I want that it closes all my operations if the equity reaches 20% decrease... fore example... What Should I do?

Raiden

Пользователь с Nov 27, 2010  243 сообщений www.raidenworks.com (Raiden) May 10 2012 at 18:53
I never mentioned Metaquotes.

Google this 'Multi Purpose Trade Management EA'. Read the 1st entry, it should be from forexfactory.com

... sometimes I can sympathise with Steve.


Consistency above all.
carlosforex

Пользователь с Apr 17, 2012  7 сообщений carlosforex May 10 2012 at 18:57
Thank you, but I still do not understand... What do I have to do with what you wrote before?

Raiden

Пользователь с Nov 27, 2010  243 сообщений www.raidenworks.com (Raiden) May 11 2012 at 02:14
You could copy that text, open the Meta Editor, and paste that into an EA. (There are two more variables that need to be defined though.)

But you should skip that and just use the Multi Purpose Trade Management EA by Steve Hopwood in the forexfactory.com link.

Consistency above all.
Raiden

Пользователь с Nov 27, 2010  243 сообщений www.raidenworks.com (Raiden) May 13 2012 at 02:18 (Отредактировано May 13 2012 at 02:18 )
Whoops, I notice my comments in my CloseAll() function says it closes Pending Orders too but it doesn't. I forgot to update it when I separated it out.

Consistency above all.
Professor53

Пользователь с Dec 15, 2010  396 сообщений www.Professor53.com (Professor53) May 26 2012 at 19:26
I have a programmer that could do that money management program change for a fee. Hes very good. Most likely would charge form $35 to $75 would be my guess if the prg isnt private or locked.

Click on my Name to see My Live Charts and Bio.
Raiden

Пользователь с Nov 27, 2010  243 сообщений www.raidenworks.com (Raiden) May 31 2012 at 01:56
I've written the EA, you can find it here.

http://raidenworks.com/2012/05/31/drawdown-percent-close-ea/

Consistency above all.
Financialarts

Пользователь с May 30, 2012  129 сообщений Financialarts May 31 2012 at 06:05
Dude i would program those lines for ar 5 $
This is one or 2 simple for functions till everything is closed

I am the change in the market that causes you to lose :p / Watch out before I negative pip you! ^^
Предыдущий 1 2 Следующий
Bank of Japan Governor Kuroda Speech (8h 54min)
Obama urges U.S. to honor fallen soldiers(2h 0min ago)
EURUSD 1.29328 GBPUSD 1.51194
USDJPY 101.25 USDCAD 1.03196
Tools Сообщество Обзоры Платформа Компания Поддержка
Экономический календарь Сообщество Брокеры Виджеты О нас ЧаВо
Forex Market Системы Советник Особенности Блог Помощь
Forex Volatility Most Popular Systems Провайдеры торговых сигналов API Твиттер Связаться с нами
Forex Correlation Стратегии VPS Services Мобильные устройства Facebook Сообщ. об ошибке!
Спрэды форекс брокеров Конкурсы EA Programming Переводы    
Котировки форекс брокеров Forex Charts PAMM Brokers RSS    
Forex Broker Swaps Community Outlook Rebate Programs      
Новости Forex одной строкой   Trading Platforms      
Forex Broker Volume          
COT Data New          

Карта сайта  |   Terms & Conditions  |   Политика конфиденциальности
©2012 Myfxbook Ltd. All Rights Reserved.
HIGH RISK WARNING: Foreign exchange trading carries a high level of risk that may not be suitable for all investors. Leverage creates additional risk and loss exposure. Before you decide to trade foreign exchange, carefully consider your investment objectives, experience level, and risk tolerance. You could lose some or all of your initial investment; do not invest money that you cannot afford to lose. Educate yourself on the risks associated with foreign exchange trading, and seek advice from an independent financial or tax advisor if you have any questions. Any data and information is provided 'as is' solely for informational purposes, and is not intended for trading purposes or advice.