Can anybody stop/fix this EA from hedging in the opposite position. By fix I mean don't try to BUY when you have a Short position. This EA was meant to add to its BUY position at times but not hedge in the opposite direction.
Not sure of terminology, does hedge mean enter opposite position or can it mean add to present position ??
thanks
Ray
Wapens Renko hedges
- traderduke
- Trader
- Posts: 306
- Joined: Mon Nov 28, 2011 7:30 pm
- Location: East Coast USA
Wapens Renko hedges
You do not have the required permissions to view the files attached to this post.
-
phil_trade
Re: Wapens Renko hedges
Hitraderduke wrote:Can anybody stop/fix this EA from hedging in the opposite position. By fix I mean don't try to BUY when you have a Short position. This EA was meant to add to its BUY position at times but not hedge in the opposite direction.
Not sure of terminology, does hedge mean enter opposite position or can it mean add to present position ??
thanks
Ray
you can use/adapt code from Marylin http://www.stevehopwoodforex.com/phpBB3 ... f=5&t=1448
ex. for sell
Code: Select all
if(CountBuys(Symbol(),MagicNumber)==0)
{
/... your sell code
}
Code: Select all
if(CountSells(Symbol(),MagicNumber)==0)
{
/... your buy code
}
Code: Select all
int CountBuys(string strSymbol, int nMagic)
{
int nOrderCount=0;
for (int i=OrdersTotal()-1 ; i>=0 ; i--)
{
if (!OrderSelect(i,SELECT_BY_POS)) continue;
if (OrderType() == OP_BUY)
if (OrderMagicNumber() == nMagic)
if (OrderSymbol() == strSymbol)
nOrderCount++;
}
return(nOrderCount);
}
int CountSells(string strSymbol, int nMagic)
{
int nOrderCount=0;
for (int i=OrdersTotal()-1 ; i>=0 ; i--)
{
if (!OrderSelect(i,SELECT_BY_POS)) continue;
if (OrderType() == OP_SELL)
if (OrderMagicNumber() == nMagic)
if (OrderSymbol() == strSymbol)
nOrderCount++;
}
return(nOrderCount);
}Philippe
- traderduke
- Trader
- Posts: 306
- Joined: Mon Nov 28, 2011 7:30 pm
- Location: East Coast USA
Re: Wapens Renko hedges
Phil
Thanks for info, I'll give it a try.
Ray
Thanks for info, I'll give it a try.
Ray
phil_trade wrote:Hitraderduke wrote:Can anybody stop/fix this EA from hedging in the opposite position. By fix I mean don't try to BUY when you have a Short position. This EA was meant to add to its BUY position at times but not hedge in the opposite direction.
Not sure of terminology, does hedge mean enter opposite position or can it mean add to present position ??
thanks
Ray
you can use/adapt code from Marylin http://www.stevehopwoodforex.com/phpBB3 ... f=5&t=1448
ex. for sell
Code: Select all
if(CountBuys(Symbol(),MagicNumber)==0) { /... your sell code }Code: Select all
if(CountSells(Symbol(),MagicNumber)==0) { /... your buy code }CheersCode: Select all
int CountBuys(string strSymbol, int nMagic) { int nOrderCount=0; for (int i=OrdersTotal()-1 ; i>=0 ; i--) { if (!OrderSelect(i,SELECT_BY_POS)) continue; if (OrderType() == OP_BUY) if (OrderMagicNumber() == nMagic) if (OrderSymbol() == strSymbol) nOrderCount++; } return(nOrderCount); } int CountSells(string strSymbol, int nMagic) { int nOrderCount=0; for (int i=OrdersTotal()-1 ; i>=0 ; i--) { if (!OrderSelect(i,SELECT_BY_POS)) continue; if (OrderType() == OP_SELL) if (OrderMagicNumber() == nMagic) if (OrderSymbol() == strSymbol) nOrderCount++; } return(nOrderCount); }
Philippe