hi Vladimir I added macd feature to my robot. but it is not working. no eror. The feature I want is to close the position if the difference between the macd line and the signal line is 0.05. My robot is attached. can you check it? thanks
hi Vladimir I added macd feature to my robot. but it is not working. no eror. The feature I want is to close the position if the difference between the macd line and the signal line is 0.05. My robot is attached. can you check it? thanks
Hi. I have an Grid E.A that takes Buy or Sell positions at for example10 pips range with some conditions. May be there are buy or sell positions and conditions will disappear for a while and after a transition, it will be able to open other positions.
My question is : How it can not open anymore position near another positions with less than 10 pips distance? The logical solution, is to have all PiceOpens and prevent take new positions at a distance of 10 pips from top and bottom of them.But I did not reach result. Please help.
Hi. I have an Grid E.A that takes Buy or Sell positions at for example10 pips range with some conditions. May be there are buy or sell positions and conditions will disappear for a while and after a transition, it will be able to open other positions.
My question is : How it can not open anymore position near another positions with less than 10 pips distance? The logical solution, is to have all PiceOpens and prevent take new positions at a distance of 10 pips from top and bottom of them.But I did not reach result. Please help.
Describe your rules in detail ( please select the correct option ):
If I open positions like this: each next 'BUY' position should be higher and higher, each next 'SELL' position should be lower and lower - then I use this function:
//+------------------------------------------------------------------+//| Calculate all positions |//+------------------------------------------------------------------+void CalculateAllPositions_HighestBuyHighestSell(double &price_highest_buy,double &price_lowest_sell)
{
//--- auxiliary variablesdouble price_highest_buy = DBL_MIN;
double price_lowest_sell = DBL_MAX;
//---for(int i=PositionsTotal()-1; i>=0; i--)
if(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==InpMagic)
{
if(m_position.PositionType()==POSITION_TYPE_BUY)
{
if(m_position.PriceOpen()>price_highest_buy) // the highest position of "BUY" is found
price_highest_buy=m_position.PriceOpen();
continue;
}
elseif(m_position.PositionType()==POSITION_TYPE_SELL)
{
if(m_position.PriceOpen()<price_lowest_sell) // the lowest position of "SELL" is found
price_lowest_sell=m_position.PriceOpen();
}
}
}
If I open positions like this: each next 'BUY' position should be lower and lower , each next 'SELL' position should be higher and higher - then I use this function:
//+------------------------------------------------------------------+//| Calculate all positions |//+------------------------------------------------------------------+void CalculateAllPositions_LowestBuyLowestSell(double &price_highest_buy,double &price_lowest_sell)
{
//--- auxiliary variablesdouble price_lowest_buy = DBL_MAX;
double price_highest_sell = DBL_MIN;
//---for(int i=PositionsTotal()-1; i>=0; i--)
if(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==InpMagic)
{
if(m_position.PositionType()==POSITION_TYPE_BUY)
{
if(m_position.PriceOpen()<price_lowest_buy) // the lowest position of "BUY" is found
price_lowest_buy=m_position.PriceOpen();
continue;
}
elseif(m_position.PositionType()==POSITION_TYPE_SELL)
{
if(m_position.PriceOpen()>price_highest_sell) // the highest position of "SELL" is found
price_highest_sell=m_position.PriceOpen();
}
}
}
If I open positions like this: each next 'BUY' position should be higher and higher, each next 'SELL' position should be lower and lower - then I use this function:
If I open positions like this: each next 'BUY' position should be lower and lower , each next 'SELL' position should be higher and higher - then I use this function:
thank you. I have learned a lot from your contents.
In fact, no " ...each next 'BUY' position should be higher and higher ..." and no " ...each next 'BUY' position should be lower and lower..." they do not happen.
As an example, I have prepared 4 sequences of price going (of course, I have increased amount of Tr_SL).
In first image, sell positions are created with price drops.
In second image, a buy position is created by changing the conditions and increasing the price .
In third image, the price has dropped again and the conditions for creating three sell positions have been provided.
In fourth image, as the price rises, a buy position is created that is lower than the first "buy"position.
//+------------------------------------------------------------------+//| Nearest Position |//+------------------------------------------------------------------+double NearestPosition(doubleconst price)
{
double nearest=DBL_MAX;
for(int i=PositionsTotal()-1; i>=0; i--)
if(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==InpMagic)
{
double shift=MathAbs(m_position.PriceOpen()-price);
if(nearest==DBL_MAX)
nearest=shift;
elseif(shift<nearest)
nearest=shift;
}
//---return(nearest);
}
I already used that code. I integrated those codes into my own robot. but it is not working efficiently. I don't get eror. but I didn't get what I wanted. Can you help me?
I already used that code. I integrated those codes into my own robot. but it is not working efficiently. I don't get eror. but I didn't get what I wanted. Can you help me?
Attach your code, describe what exactly the code should do. Describe what exactly doesn't work.
hi Vladimir I added macd feature to my robot. but it is not working. no eror. The feature I want is to close the position if the difference between the macd line and the signal line is 0.05. My robot is attached. can you check it? thanks
Okay, I'll take a look tonight.
hi Vladimir I added macd feature to my robot. but it is not working. no eror. The feature I want is to close the position if the difference between the macd line and the signal line is 0.05. My robot is attached. can you check it? thanks
You need to use iMACD Difference Close All code. If you have questions about the code - you can ask your questions in a special thread .
Hi. I have an Grid E.A that takes Buy or Sell positions at for example10 pips range with some conditions. May be there are buy or sell positions and conditions will disappear for a while and after a transition, it will be able to open other positions.
My question is : How it can not open anymore position near another positions with less than 10 pips distance? The logical solution, is to have all PiceOpens and prevent take new positions at a distance of 10 pips from top and bottom of them.But I did not reach result. Please help.
Hi. I have an Grid E.A that takes Buy or Sell positions at for example10 pips range with some conditions. May be there are buy or sell positions and conditions will disappear for a while and after a transition, it will be able to open other positions.
My question is : How it can not open anymore position near another positions with less than 10 pips distance? The logical solution, is to have all PiceOpens and prevent take new positions at a distance of 10 pips from top and bottom of them.But I did not reach result. Please help.
Describe your rules in detail ( please select the correct option ):
If I open positions like this: each next 'BUY' position should be higher and higher, each next 'SELL' position should be lower and lower - then I use this function:
If I open positions like this: each next 'BUY' position should be lower and lower , each next 'SELL' position should be higher and higher - then I use this function:
If I open positions like this: each next 'BUY' position should be higher and higher, each next 'SELL' position should be lower and lower - then I use this function:
If I open positions like this: each next 'BUY' position should be lower and lower , each next 'SELL' position should be higher and higher - then I use this function:
thank you. I have learned a lot from your contents.
In fact, no " ...each next 'BUY' position should be higher and higher ..." and no " ...each next 'BUY' position should be lower and lower..." they do not happen.
As an example, I have prepared 4 sequences of price going (of course, I have increased amount of Tr_SL).You can search for the nearest position:
You can search for the nearest position:
iMACD Farkı Tümünü Kapatmanız gerekir . Kodla ilgili olabilecek - özel bir özellikta sorabilirsiniz .
I already used that code. I integrated those codes into my own robot. but it is not working efficiently. I don't get eror. but I didn't get what I wanted. Can you help me?
I already used that code. I integrated those codes into my own robot. but it is not working efficiently. I don't get eror. but I didn't get what I wanted. Can you help me?
Attach your code, describe what exactly the code should do. Describe what exactly doesn't work.