Forex



Go Back   Forex Trading > Programming > MetaTrader
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 06-05-2009, 05:10 AM
ajk's Avatar
ajk ajk is offline
Senior Member
 
Join Date: Dec 2005
Posts: 261
ajk is on a distinguished road
no longer hedging ?

Since hedging is not allowed anymore... does anyone have any trade ea manager or something that would reverse the trade immediately after close when a trade hits a stop loss...
or can any one show me how to add a pending order as a sell (below is a buy) so that it triggers as soon as sl is hit?
Thoughts?
ANy help appreciated!.

int OpenOrder(int type)
{
int ticket=0;
int err=0;
int c = 0;

if(type==OP_BUY)
{
for(c = 0 ; c < NumberOfTries ; c++)
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage ,Ask-StopLoss*Point,Ask+TakeProfit*Point,ExpertComment, MagicNumber,0,Yellow);
err=GetLastError();
if(err==0)
{
break;
}
else
{
if(err==4 || err==137 ||err==146 || err==136) //Busy errors
{
Sleep(5000);
continue;
}
else //normal error
{
break;
}
}
}
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 06-06-2009, 02:07 AM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 818
wolfe is on a distinguished road
Quote:
Originally Posted by ajk View Post
Since hedging is not allowed anymore... does anyone have any trade ea manager or something that would reverse the trade immediately after close when a trade hits a stop loss...
or can any one show me how to add a pending order as a sell (below is a buy) so that it triggers as soon as sl is hit?
Thoughts?
ANy help appreciated!.

int OpenOrder(int type)
{
int ticket=0;
int err=0;
int c = 0;

if(type==OP_BUY)
{
for(c = 0 ; c < NumberOfTries ; c++)
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage ,Ask-StopLoss*Point,Ask+TakeProfit*Point,ExpertComment, MagicNumber,0,Yellow);
err=GetLastError();
if(err==0)
{
break;
}
else
{
if(err==4 || err==137 ||err==146 || err==136) //Busy errors
{
Sleep(5000);
continue;
}
else //normal error
{
break;
}
}
}
}
Something like this should work, as long as your s/l is greater than the MarketInfo(Symbol(),MODE_STOPLEVEL).

PHP Code:
 int OpenOrder(int type)
  {
   
int ticket=0;
   
int err=0;
   
int c 0;
   
double StopLoss_SellStop_Open =0;

   if(
type==OP_BUY)
    {
     for(
NumberOfTries c++)
      {
       
StopLoss_SellStop_Open Ask-StopLoss*Point;
       
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage ,StopLoss_SellStop_Open,Ask+TakeProfit*Point,"ExpertComment"MagicNumber,0,Yellow);
       
err=GetLastError();
       if(
err==0)
        {
         
OrderSend(Symbol(),OP_SELLSTOP,Lots,StopLoss_SellStop_Open,Slippage,NULL,NULL,"ExpertComment",MagicNumber,0,Red);
         break;
        }
       else
        {
         if(
err==|| err==137 ||err==146 || err==136//Busy errors
          
{
           
Sleep(5000);
           continue;
          }
         else 
//normal error
          
{
           break;
          }
        }
      }
    } 
You of course would have to decide what to do for your s/l and t/p for the pending order.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 06-06-2009, 03:09 AM
Member
 
Join Date: Dec 2008
Posts: 37
wannaberich is on a distinguished road
You can still hedge with a lot of brokers, my broker still allows hedging and could not care what robot you use or if you win or lose. Just shop around you will still find many brokers that you can hedge with!

Quote:
Originally Posted by ajk View Post
Since hedging is not allowed anymore... does anyone have any trade ea manager or something that would reverse the trade immediately after close when a trade hits a stop loss...
or can any one show me how to add a pending order as a sell (below is a buy) so that it triggers as soon as sl is hit?
Thoughts?
ANy help appreciated!.

int OpenOrder(int type)
{
int ticket=0;
int err=0;
int c = 0;

if(type==OP_BUY)
{
for(c = 0 ; c < NumberOfTries ; c++)
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage ,Ask-StopLoss*Point,Ask+TakeProfit*Point,ExpertComment, MagicNumber,0,Yellow);
err=GetLastError();
if(err==0)
{
break;
}
else
{
if(err==4 || err==137 ||err==146 || err==136) //Busy errors
{
Sleep(5000);
continue;
}
else //normal error
{
break;
}
}
}
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #4 (permalink)  
Old 06-08-2009, 12:16 AM
ajk's Avatar
ajk ajk is offline
Senior Member
 
Join Date: Dec 2005
Posts: 261
ajk is on a distinguished road
thanks for the potential programming!.

Last edited by ajk; 06-09-2009 at 03:25 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #5 (permalink)  
Old 06-09-2009, 03:24 AM
ajk's Avatar
ajk ajk is offline
Senior Member
 
Join Date: Dec 2005
Posts: 261
ajk is on a distinguished road
Quote:
Originally Posted by ajk View Post
thanks for the potential programming!.
It was working sweet...however, IBFX "stated HEdge not allowed" even though. My buy stop / sell stop was above my stop loss

Cant those losers just process these trades.... What a bunch of crap.
argh...my only thoughts now are to wait until the trade closed and somehow program after close to reverse


Any suggestions from anyone ? on how to do that?

Never mind..moved my $;s overseas.
AWESOME PROGRAMMING ! love the feedback ..runnin live already!

Last edited by ajk; 06-09-2009 at 03:28 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Longer Term Trend Filter agisthos Metatrader 4 8 06-14-2009 04:25 PM
No more hedging JoZo General Discussion 15 04-28-2009 07:46 AM
MT4 Problem: EAs no longer work et_phonehome_2 Metatrader 4 3 12-29-2006 01:30 PM
Alpari Tick data no longer? drgoodvibe Metatrader 4 2 11-08-2006 01:20 AM
Best Oscillator to judge longer term trend ? samarkand General Discussion 1 05-12-2006 08:31 PM


All times are GMT. The time now is 01:18 PM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.