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;

}

}

}

}

 
ajk:
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).

int OpenOrder(int type)

{

int ticket=0;

int err=0;

int c = 0;

double StopLoss_SellStop_Open =0;

if(type==OP_BUY)

{

for(c = 0 ; c < 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==4 || 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.

 

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!

ajk:
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;

}

}

}

}
 

thanks for the potential programming!.

 
ajk:
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!