[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 1079
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Something just doesn't seem to be working. PLEASE HELP.
The idea is this: if the candle is above a certain value, then prohibit further trading.
bool Trade=true;
//---------- start()
{.......
if(CalculateCurrentOrders(Symbol())==0 && CheckVolume()==1) CheckForOpen(); //--------open order if (no order is open) AND (candlestick is not bigger than)
if(CalculateCurrentOrders(Symbol())==0 && CheckVolume()==-1) Trade=false; //--------- set Tradeto false provided (no open orders) AND (the candlestick is greater than)
......}
//------- Trade is used in CheckForOpen() function.
void CheckForOpen() //------------------- check conditions and open order
{int res;
if( Trade && A()==-1 && B()==-1) //------- check open conditions
{ res=OrderSend(Symbol(),OP_SELL,Lot,Bid,2,Ask+SL*Point,Bid-TP*Point,"",MAGICMA,0,Red); //--------- if the condition is met, the order is opened
trade=false; } //--------Trade is assigned a trade-ban value. And here it works. If the order closes at the take order, it then waits for the new definite conditions to come, even though the old ones are still in effect (before, the advisor opened orders continuously)
.........}
//-------------------------- check candle height
int CheckVolume()
{ double volume=High[1]-Low[1]; //-------measuring the candlestick height
if (volume <= CandleVolume*Point) return (1); //---------- if the candle is lower than
if (volume > CandleVolume*Point) return (-1);//------------if the candle is more than
return(0);}
Also tried version, but it didn't work:
void start()
{ .....
if(CalculateCurrentOrders(Symbol())==0 && CheckVolume()==1) CheckForOpen();
.....}
.....
int CheckVolume()
{ double volume=High[1]-Low[1]; //-------measurement of candle height
if (volume <= CandleVolume*Point) return (1); //---------- if the candle is lower than
if (volume > CandleVolume*Point) {Trade=false; return (-1);}//------------if the candle is higher than
return(0);}
There's no way it's going to work.
Maybe we should do an indicator first
Maybe we should make an indicator first
Help me out here ! How do I make a print appear once, but on every tick I have a print drop.
Help me out here ! How do I make a print appear once, but on every tick I get a print drop.
output this print when the order is opened.
I need to output information about orders that have already been opened manually or by another EA.
I need to display information about existing orders that have already been opened manually or by another EA.
What is this error? If I send a test mail from the terminal I get an error
- 2010.12.28 18:23:55 Mail: 530 5.7.0 Must issue a STARTTLS command first. y1sm3265289fak.15
and there's no way to do it without it?
You can, of course, but the indicator makes it easy to check the algorithm visually
I need to display information about existing orders that have already been opened manually or by another EA.
Alternatively, we can make a counter of prints. We declare an integer variable. Then we check if there are no orders, we set it to zero. Then we check if the variable is equal to zero and there are orders in the market, then we print the order data and increment this variable by 1. As soon as the orders are closed, the variable will be set to zero again. This means that the code will wait for at least one order to appear and display information about it in the log.