[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 594

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
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && // check for opened position
OrderSymbol()==lSymbol()) // check for symbol
{
?
Help with the code plz! Why do I get 138 in this code, and what does it have to do with it? deals open, but when you close the price is somehow not the same, what is it? everything is simple. expert advisor in s candles should close the deal and open when the fractal is penetrated. thanks in advance for the tip
extern int s=5;
extern int stime=60;extern int lots=1;
extern int slippage=5;
extern double sl=NULL;
extern double tp=NULL;
double upfr,dnfr=0.0;//levels of last fractals
double tClose=NULL;
double tOpen=NULL;
int flag=0;
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()//open on breakout and close after s candles
{
//----
upfr=iFractals(Symbol(),PERIOD_H1,MODE_UPPER,4)
dnfr=iFractals(Symbol(),PERIOD_H1,MODE_LOWER,4);
//OPPER ORDERS ON PROBIT
if(upfr>0 && High[1]>upfr && flag==0) //if the fractal is up and the fractal level is exceeded
{
tOpen=Time[0];
tClose=tOpen+s*stime*60;
OrderSend(Symbol(),OP_BUY,lots,Bid,slippage,sl,tp);
flag=1;
}
if(dnfr>0 && Low[1]<dnfr && flag==0)//if fractal is down and fractal level is down
{
tOpen=Time[0];
tClose=tOpen+s*stime*60;
OrderSend(Symbol(),OP_SELL,lots,Ask,sl, sl, tp);
flag=1;
}
// CLOSE ORDERS BY END OF TIME
if(Time[0]>=tClose )// if time before closing has passed
{
Print("CLOSE FUNCTION");
OrClose();
flag=0;
}
//----
return(0);
}
//+------------------------------------------------------------------+
//close all orders
void OrClose()
{
for(int i=OrdersTotal()-1;i>=1;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
OrderClose(OrderTicket(),lots,OrderOpenPrice(),0.0005);
}
}
return(0);
}
Help with code plz! Why am I getting a 138 error in this code??? and what does it have to do with it? deals open, but when you close the price is somehow not the same, what is it?
change it to
Good afternoon.
Please help me with opening orders. I am using an EA on a demo account, when I get a Buy or Sell condition, it shows 130 errors.
Here is the order opening function:
I checked on other EA and found that all was ok with lot calculation.
Demo account at Alpari, Micro type. take and stop are 100p, soot. 10 pips, as Alpari has 5 sign
Normalize the opening price.
How do you normalize it?
Right?
If so, nothing changes.
I don't have much experience in programming yet. Can you please explain how to normalize it?
Good evening. Question: When I close part of a trade, the EA kind of opens a new trade with a new ticket. Does the magik of the new order remain the same?