|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Quote:
FerruFx
__________________
THE HEART of FOREX & THE PROBABILITY METER - Trade with 100% confidence and ... Stress Less!!! Coding services: Experts Advisors, indicators, alerts, etc ... more info by PM NEW: video presentation of the Probability Meter ... 24hrs action on the website |
|
||||
|
I threw together an adjust trailing stop function for EAs, can someone check it out?
Code:
//+-----------------------------------------------------+
//| adjust trailing stop |
//+-----------------------------------------------------+
void AdjustTrailingStop()
{
int orders = OrdersTotal();
for(int j=orders-1;j>=0;j--)
{
OrderSelect(j, SELECT_BY_POS);
int type = OrderType();
//-- Adjust trailing stop for BUYs
if (type == OP_BUY && OrderSymbol()==Symbol() && (OrderMagicNumber() == MagicNumber))
{
if (Ask-TrailingStop*Point > OrderOpenPrice() && Ask-TrailingStop*Point > OrderStopLoss())
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask-TrailingStop*Point,OrderTakeProfit(),0);
}
}
//-- Adjust trailing stop for SELLs
if (type == OP_SELL && OrderSymbol()==Symbol() && (OrderMagicNumber() == MagicNumber))
{
if (Bid+TrailingStop*Point < OrderOpenPrice() && Bid+TrailingStop*Point < OrderStopLoss())
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid+TrailingStop*Point,OrderTakeProfit(),0);
}
}
}
}
__________________
You can find me on irc.ircforex.com most of the time... on #forex Myspace Facebook My Indicators: Trade Assistant Trend Friend ToR CCI Helper Holder of US Patent 6,774,788 |
|
|||
|
Please, try this:
PHP Code:
|
|
|||
|
Quote:
PHP Code:
|
|
|||
|
thank you for edite expert
can you change this ea using my idea ![]() from my idea after opening two orders we explain this info 1- all orders have fix stop loss same 10pip 2-if the first order going to profit opening 2* same this order but tp=fist order tp-fix sl 3- traling sl to second order opening place exampel: eur/usd on the first price is : 1.5200 1-opening two orders ( buy@ 1.5200 0.1 lot size sl=10 tp 50 & sell@1.5200 0.1 lot size sl=10 tp=50) price go to 15210 2-at this time (my sell order will be close & will opening second buy order 0.2 lot size by sl=10 tp=40 and fist order sl traling to 1.5210 ) price go to 1.5220 3-at this time (opening buy order 0.4 lot size by sl=10 tp=30 and two befor orders sl traling to 1.5220) 4-..... 5.... if the price going to 1.5250 all orders will be close by 560$ but at this time our orders sl we only lossing 60$ this method have very best risk ![]() Last edited by birami : 05-04-2008 at 01:25 PM. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to code this? | iscuba11 | Metatrader 4 mql 4 - Development course | 1 | 08-03-2007 04:22 PM |