[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 475
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
Thank you!!!
Here's the starting link - then the rest, IMHO.
Please explain
The analytical part uses a rigidly defined timeframe. Or timeframes
The analytical part uses a rigidly defined timeframe. Or timeframes
could you please drop the "fish" for parsing, if you have any comments I would appreciate it
OK, I've got an idea, maybe it's a bit horny... Nah, it's just not quite right, it looks like when a buy order is detected, all the pending orders will be removed... All buy orders. stsBUY should be set before the start. I have not checked for errors.
We would need a more correct code. No errors
And the logic is bad.
Could you please drop the "fish" for the parse, if you have any comments I would appreciate it.
You should at least read the textbook a little bit, so you don't have to ask how many "two times two" is.
You should at least read the textbook a little bit, so you don't have to ask how much "two times two" is.
I don't argue that it's an important point, but if I understood it, I wouldn't be asking, right?
i.e. in the algorithm, where the timeframes in the indicators are specified, we clearly spell it out.
Right?
then explain the following to me ....
Expert Advisor - crossing of stochastics, entry into a trade.
Here is the algorithm
int start()
{
RefreshRates(); // Refresh data
Symb=Symbol();
x1=x;
y1=y;
x=iStochastic( NULL,0,5,3,3,MODE_SMA,1,0,0); // stochastic main line value on the 0 bar
y=iStochastic( NULL,0,5,3,3,MODE_SMA,1,1,0); // stochastic signal line value on the 0 bar
Alert ("stochastic main",x);
Alert ("stochastic signal",y);
//---- intersection ofsignal and main line
if (y < x && y1> x1) // Check up pass
{
f=1 // flag up
}
//--------------------------------------------------------------------
if (y > x && y1< x1) // check downwards passage
{
f=2; // flag down
}
//---- check downwards intersection of the main line with line 20
if (f==1 && x1<20&& x1<20 && x>= 20)
{ if (Ticket > 0) // if there is an order, remove it
OrderClose(Ticket,Lts,Bid,10);
SL=Bid - StopLoss*Point; // Calculation of SL open
TP=Bid + TakeProfit*Point; // Calculation of TP open.
Alert("Attempting to open Buy. Waiting for reply...");
OrderSelect(Ticket, SELECT_BY_TICKET);
if(OrderCloseTime()>0 || !OrderSelect(Ticket, SELECT_BY_TICKET))
{
Ticket=OrderSend(Symb,OP_BUY,Lts,Ask,3,SL,TP);//open Buy
}
if (Ticket > 0) // It worked :)
{
Alert ("Opened Buy order ",Ticket);
return;
f=0; // reset flag
}
}
//---- check crossing of main line from top to bottom of line 80
if (f==2 &&& x1>80 && x<= 80)
{ if (Ticket > 0)
OrderClose(Ticket,Lts,Ask, 10); // if there is an order, remove
SL=Ask + StopLoss*Point; // Calculation of SL
TP=Ask - TakeProfit*Point; // Calculation of TP open.
Alert("Attempting to open Sell. Waiting for reply...");
OrderSelect(Ticket, SELECT_BY_TICKET);
if(OrderCloseTime()>0 || !OrderSelect(Ticket, SELECT_BY_TICKET))
{
Ticket=OrderSend(Symb,OP_SELL,Lts,Bid,3,SL,TP);//Open Buy
}
if (Ticket > 0) // It worked :)
{
Alert ("Sell order opened ",Ticket);
return;
f=0; // zeroize flag
}
}
return(0);
}
if we run, the Expert Advisor will open and close orders within half an hour, i.e., open at 9.04, close at 9.05, open again at 9.06, close at 9.07 and so on, in the same direction.
why does this happen?
Regards.
And if two BUYLIMIT and BUYSTOP orders are open, I need to delete BUYSTOP at BUYLIMIT triggering and vice versa. Can you tell me how this condition can be fulfilled?
Actually, the logic should go something like this:
1. If there are two pending orders and no positions, then remember the ticks of these pending orders in the variables.
2. If there is a pending SellStop and there is no pending BuyStop, if there is a Buy position, compare the ticket of the last opened Buy position with the remembered BuyStop ticket.
If they are equal, it means ByStop was converted to market Buy --> if there is a pending SellStop - delete it. 3.
If there is a pending BuyStop and no pending SellStop, if there is a Sell position, compare the ticket of the last opened Sell position with the remembered SellStop ticket.
If they are equal, then SellStop is converted to market Sell --> if there is a pending BuyStop - delete it.
About the same... This is only a rough logic. It needs functions.