You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Vladimir, figured it out, got it running. Where can I swap sell orders with buy orders here?
Each signals module has two functions, which are used to issue buy or sell signals. These are "LongCondition" and "ShortCondition".
Each signals module has two functions, which are used to issue buy or sell signals. These are "LongCondition" and "ShortCondition".
I understand that in your EA these are:
{
int result=0;
int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(m_reverse)
if(DiffCloseMA(idx)>0.0)
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
if(!m_reverse)
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
//--- return the result
return(result);
}
//+------------------------------------------------------------------+
//| "Voting" that price will fall. |
//+------------------------------------------------------------------+
int CSignalMA::ShortCondition(void)
{
int result=0;
int idx =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(m_reverse)
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
if(!m_reverse)
if(DiffCloseMA(idx)>0.0)
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
//--- return the result
return(result);
}
//+------------------------------------------------------------------+
and where is the line here that is responsible for the action? And how do I change this property?
I understand that in your EA this is:
{
int result=0;
int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(m_reverse)
if(DiffCloseMA(idx)>0.0)
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
if(!m_reverse)
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
//--- return the result
return(result);
}
//+------------------------------------------------------------------+
//| "Voting" that price will fall. |
//+------------------------------------------------------------------+
int CSignalMA::ShortCondition(void)
{
int result=0;
int idx =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(m_reverse)
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
if(!m_reverse)
if(DiffCloseMA(idx)>0.0)
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
//--- return the result
return(result);
}
//+------------------------------------------------------------------+
and where is the line here that is responsible for the action? And how do I change this property?
Please insert the code correctly:Insert code correctly in the forum
You cited the code NOT FROM THE CODE, but from the SIGNALS MODULE.
You don't need to change anything in my module to change signal direction, because it has "Reverse" setting - depending on what value it has (true or false) the signals can be reversed directly.
Using the "LongCondition" example:
if reverse ("m_reverse") is true and the closing price minus the indicator value is greater than zero - then we give the signal "Long" (Buy, buy)
{
int result=0;
int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(m_reverse)
if(DiffCloseMA(idx)>0.0)
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
if(!m_reverse)
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
//--- return the result
return(result);
}
Please insert the code correctly:Insert code correctly in the forum
You have NOT pasted the code from the ADVISOR, but from the SIGNAL MODULE.
You don't need to change anything to change the direction of the signal in my module, because it has the "Reverse" setting - depending on what value it has (true or false) the signals can be reversed directly.
Using the "LongCondition" example:
if "m_reverse" is true and the closing price minus the indicator value is greater than zero - then the signal "Long" (Buy, buy) is given
{
int result=0;
int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(m_reverse)
if(DiffCloseMA(idx)>0.0)
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
if(!m_reverse)
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
//--- return the result
return(result);
}
Vladimir, there is a new problem. Your Expert Advisor has compiled, but when I try to drag it to the chart and agree with the settings. I see an icon in the right corner showing that the Expert Advisor has been launched. Then it disappears at once. What may be the reason? This reverse is a good one. How can it be applied in other EAs?
Vladimir, there is a new problem. Your EA has compiled, but when I try to drag it onto a chart and agree with the settings. I see an icon in the right corner saying that the EA is running for a while. Then it disappears at once. What may be the reason? This reverse is a good one. How can it be applied to other EAs?
Look for error messages in the "Toolbox" window of the terminal in the "Experts" and "Journal" tabs...
I understand this is the section that is responsible for opening a position if "price will rise" in the SignalMA.mqh file ?
//| "Voting" that price will grow. |
//+------------------------------------------------------------------+
int CSignalMA::LongCondition(void)
{
int result=0;
int idx =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator
if(IS_PATTERN_USAGE(1) && DiffOpenMA(idx)>0.0 && DiffMA(idx)>0.0)
{
//--- the open price is above the indicator (i.e. there was an intersection), but the indicator is directed upwards
result=m_pattern_1;
//--- consider that this is an unformed "piercing" and suggest to enter the market at the current price
m_base_price=0.0;
}
}
else
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
//--- if the indicator is directed upwards
if(DiffMA(idx)>0.0)
{
if(DiffOpenMA(idx)<0.0)
{
//--- if the model 2 is used
if(IS_PATTERN_USAGE(2))
{
//--- the open price is below the indicator (i.e. there was an intersection)
result=m_pattern_2;
//--- suggest to enter the market at the "roll back"
m_base_price=m_symbol.NormalizePrice(MA(idx));
}
}
else
{
//--- if the model 3 is used and the open price is above the indicator
if(IS_PATTERN_USAGE(3) && DiffLowMA(idx)<0.0)
{
//--- the low price is below the indicator
result=m_pattern_3;
//--- consider that this is a formed "piercing" and suggest to enter the market at the current price
m_base_price=0.0;
}
}
}
}
//--- return the result
return(result);
}
What if you replace this with code from your module, will it work correctly. The thing is that the content is slightly different from yours. There is more code here... hmm.
I understand this is the section that is responsible for opening a position if "price will rise" in the SignalMA.mqh file ?
//| "Voting" that price will grow. |
//+------------------------------------------------------------------+
int CSignalMA::LongCondition(void)
{
int result=0;
int idx =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator
if(IS_PATTERN_USAGE(1) && DiffOpenMA(idx)>0.0 && DiffMA(idx)>0.0)
{
//--- the open price is above the indicator (i.e. there was an intersection), but the indicator is directed upwards
result=m_pattern_1;
//--- consider that this is an unformed "piercing" and suggest to enter the market at the current price
m_base_price=0.0;
}
}
else
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
//--- if the indicator is directed upwards
if(DiffMA(idx)>0.0)
{
if(DiffOpenMA(idx)<0.0)
{
//--- if the model 2 is used
if(IS_PATTERN_USAGE(2))
{
//--- the open price is below the indicator (i.e. there was an intersection)
result=m_pattern_2;
//--- suggest to enter the market at the "roll back"
m_base_price=m_symbol.NormalizePrice(MA(idx));
}
}
else
{
//--- if the model 3 is used and the open price is above the indicator
if(IS_PATTERN_USAGE(3) && DiffLowMA(idx)<0.0)
{
//--- the low price is below the indicator
result=m_pattern_3;
//--- consider that this is a formed "piercing" and suggest to enter the market at the current price
m_base_price=0.0;
}
}
}
}
//--- return the result
return(result);
}
What if you replace this with the code from your module, will it work correctly. The thing is that the content is slightly different from yours. There is more code here... hmm.
If you just take my code and paste it here, it won't work.
If you just take my code and paste it here, it won't work.
If you just take my code and paste it here - it won't work.
Vladimir, where should we paste the reverse to make it work?
It is clear that you will need to create a copy of the file and change the name of this inlude.
If you want to change the signals to reverse in the standard signal module:
//+------------------------------------------------------------------+
//| Description of the class |
//| Title=*** |
//| Type=SignalAdvanced |
//| Name=Moving Average |
If you want to change the signals to reverse in the standard signal module:
//+------------------------------------------------------------------+
//| Description of the class |
//| Title=*** |
//| Type=SignalAdvanced |
//| Name=Moving Average |
Vladimir, thank you, you have been very helpful. Now the question remains how to make the Take Profit and Stop Loss orders which the EA places. How do I make them limit?