What kind of error is this, I take it from the DC's side of bad debriefing?
128
ERR_TRADE_TIMEOUT
Timeout expired
Piece of the handler:
case128:
str="Истек срок ожидания совершения сделки.";
if(detailed) str=::StringConcatenate(str, "\n", "Прежде, чем производить повторную",
" попытку (не менее, чем через 1 минуту), необходимо убедиться,",
" что торговая операция действительно не прошла (новая позиция",
" не была открыта, либо существующий ордер не был изменён или",
" удалён, либо существующая позиция не была закрыта).");
break;
I have these error handlers in my code, but they never existed. Today I decided to check my program at demo of one popular brokerage company and faced with such bugs for the first time.
I understand correctly that this is a hardware problem at the brokerage company and not on my side?
Please tell me if this function is correct. The idea is to calculate if the price has broken through the average price during a certain amount of previous candles.
the function is not executed at all, the result should be: if it has not broken returnToMA ==1, if it has broken returnToMA ==0
Please tell me if this function is correct. The idea is to calculate if the price has broken through the average price during a certain amount of previous candles.
the function is not executed at all, the result should be: if it has not broken returnToMA ==1, if it has broken returnToMA ==0
Maybe there are other solutions to this problem?
Your function will always have zero because the maximum or minimum is always greater than/less than or equal to the MA.
The candlestick must be described by at least two parameters in your case:
1) Define where the candlestick opened - above or below the MA
2. Depending on 1, check whether the MA was touched.
You will always have zero in the function - as the maximum or minimum is always greater than/less than or equal to the MA.
The candlestick must be described by at least two parameters in your case:
1. determine where the candlestick opened - above or below the MA
2. Depending on 1, check if the MA was touched.
Thank you. I added the condition but it always returns 1. Can I change the brackets somewhere? Or break does not work and the function terminates by assigning 1 to the return value
int MAtouch(ENUM_TIMEFRAMES tfpricereturnafterbreak=PERIOD_H4, int tradema=10, int bars=100)
Thanks. I added the condition, but it always returns 1. Can I change the brackets somewhere? Or break does not work and the function terminates by assigning 1 to the return value
int MAtouch(ENUM_TIMEFRAMES tfpricereturnafterbreak=PERIOD_H4, int tradema=10, int bars=100)
What kind of error is this, I take it from the DC's side, a bad workout?
What kind of error is this, I take it from the DC's side of bad debriefing?
128
ERR_TRADE_TIMEOUT
Timeout expired
Piece of the handler:
128
ERR_TRADE_TIMEOUT
Timeout expired for trade execution
Piece of the handler:
I have these error handlers in my code, but they never existed. Today I decided to check my program at demo of one popular brokerage company and faced with such bugs for the first time.
I understand correctly that this is a hardware problem at the brokerage company and not on my side?
Please tell me if this function is correct. The idea is to calculate if the price has broken through the average price during a certain amount of previous candles.
the function is not executed at all, the result should be: if it has not broken returnToMA ==1, if it has broken returnToMA ==0
maybe there is another solution to this problem?
returnToMA = MAtouch(TRADE_TF2,TRADE_TF2_MA,barscount)
int MAtouch(ENUM_TIMEFRAMES tfpricereturnafterbreak=PERIOD_H4, int tradema=10, int bars=100)
{
for(i=0;i<=bars;i++)
{
if(iLow(Symbol(),tfpricereturnafterbreak,i)<=iMA(Symbol(),tfpricereturnafterbreak,tradema,0,MODE_EMA,PRICE_WEIGHTED,i)) {return(0);break;}
if (iHigh(Symbol(),tfpricereturnafterbreak,i)>=iMA(Symbol(),tfpricereturnafterbreak,tradema,0,MODE_EMA,PRICE_WEIGHTED,i)) {return(0);break;}
else return(1);
}
Please tell me if this function is correct. The idea is to calculate if the price has broken through the average price during a certain amount of previous candles.
the function is not executed at all, the result should be: if it has not broken returnToMA ==1, if it has broken returnToMA ==0
Maybe there are other solutions to this problem?
Your function will always have zero because the maximum or minimum is always greater than/less than or equal to the MA.
The candlestick must be described by at least two parameters in your case:
1) Define where the candlestick opened - above or below the MA
2. Depending on 1, check whether the MA was touched.
You will always have zero in the function - as the maximum or minimum is always greater than/less than or equal to the MA.
The candlestick must be described by at least two parameters in your case:
1. determine where the candlestick opened - above or below the MA
2. Depending on 1, check if the MA was touched.
Thank you. I added the condition but it always returns 1. Can I change the brackets somewhere? Or break does not work and the function terminates by assigning 1 to the return value
int MAtouch(ENUM_TIMEFRAMES tfpricereturnafterbreak=PERIOD_H4, int tradema=10, int bars=100)
{
for(i=0;i<=bars;i++)
{
if( iLow(Symbol(),tfpricereturnafterbreak,i)<=iMA(Symbol(),tfpricereturnafterbreak,tradema,0,MODE_EMA,PRICE_WEIGHTED,i)
&&iOpen(Symbol(),tfpricereturnafterbreak,i)>=iMA(Symbol(),tfpricereturnafterbreak,tradema,0,MODE_EMA,PRICE_WEIGHTED,i))
{return(0);break;}
if ( iHigh(Symbol(),tfpricereturnafterbreak,i)>=iMA(Symbol(),tfpricereturnafterbreak,tradema,0,MODE_EMA,PRICE_WEIGHTED,i)
&&iOpen(Symbol(),tfpricereturnafterbreak,i)<=iMA(Symbol(),tfpricereturnafterbreak,tradema,0,MODE_EMA,PRICE_WEIGHTED,i))
{return(0);break;}
else return(1);
}
Thanks. I added the condition, but it always returns 1. Can I change the brackets somewhere? Or break does not work and the function terminates by assigning 1 to the return value
int MAtouch(ENUM_TIMEFRAMES tfpricereturnafterbreak=PERIOD_H4, int tradema=10, int bars=100)
{
for(i=0;i<=bars;i++)
{
if( iLow(Symbol(),tfpricereturnafterbreak,i)<=iMA(Symbol(),tfpricereturnafterbreak,tradema,0,MODE_EMA,PRICE_WEIGHTED,i)
&&iOpen(Symbol(),tfpricereturnafterbreak,i)>=iMA(Symbol(),tfpricereturnafterbreak,tradema,0,MODE_EMA,PRICE_WEIGHTED,i))
{return(0);break;}
if ( iHigh(Symbol(),tfpricereturnafterbreak,i)>=iMA(Symbol(),tfpricereturnafterbreak,tradema,0,MODE_EMA,PRICE_WEIGHTED,i)
&&iOpen(Symbol(),tfpricereturnafterbreak,i)<=iMA(Symbol(),tfpricereturnafterbreak,tradema,0,MODE_EMA,PRICE_WEIGHTED,i))
{return(0);break;}
else return(1);
}
Try it like this
It will return 1 if the condition is met - there was an intersection - isn't that what we want?
Try this
It will return 1 if the condition is met - there was an intersection - isn't that what we want?
Thank you, it works like clockwork with your version of the code
Good afternoon!
Guys, can you tell me if you can programmatically display the indicator on the chart? Or only manually?
If so, what command is given?