[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 127

 
orb:

Please help. Can the conditions below be met???

We need to make so that if the current price crosses the MA, the algorithm in { } is triggered:


Does it make no difference which way it crosses? Genius tactic I guess...

Expert Advisors with MA crossing and other indicators in kodobase are many, no need to re-do the wheel ;)

 
You need to whisk the previous price in a static variable, and compare each tick so that the waving is between them (the current previous price)
 
Understood.
 
FAQ:
You need to whisk the previous price in a static variable, and compare each tick so that the waving is between them (the current previous price)

Like this?

if ((Low[1]>MA) && (Bid<MA))
{
 ...
}
if ((High[1]<MA) && (Ask>MA))
{
 ...
}
 

Error 130 is coming up. I have read the help, I don't understand what the error is...

extern int TP=10;
extern int SL=40;
extern double lot=1;
extern int slippage=3;
...
if ((l==true)&&(proves==true)) OrderSend(Symbol(),OP_SELL,lot,Bid,slippage,Ask-SL*Point,TP*Point+Ask,0,0,0,Green);
...
if ((l==true)&&(proves==true)) OrderSend(Symbol(),OP_BUY,lot,Ask,slippage,Bid-SL*Point,Bid+TP*Point,0,0,0,Red);
 

130 - Stops too close or incorrectly calculated or non-normalised prices in the stops (or in the opening price of the pending order). The attempt can only be repeated if the error has occurred due to price obsolescence. It is necessary to refresh the data after a delay of 5 seconds or more using the RefreshRates function and try again. If the error persists, you should stop all trading attempts and change the program logic.

See here.

 

Error 130. Incorrect stops

Probably, too close to the market which is not allowed by your brokerage company but most probably you should set an order without stops and profits and then modify the order during the next cycle and add profit and stop, as most brokerage companies now require.

 

Is it possible to output the Commments from the EA to another chart with a different TF? Thank you in advance!

 
No, you can only write and draw in your window, unless of course you use WINAPI, but I don't think this method will work for you
 
start(){static double pBid = 0;
   RefreachRates(); 
   if(pBid==0){pBid=Bid;}
   
   double Ma = iMa(bla,bla,bla.....
   
   if((pBid>Ma&&Bid<=Ma)||(pBid>=Ma&&Bid<Ma)){
       if(OrdersTotal()<1){
           // Open BUY order
       }
   }
   if((pBid<Ma&&Bid>=Ma)||(pBid<=Ma&&Bid>Ma)){
       if(OrdersTotal()<1){
           // Open SELLorder
       }
   }
   забыл : pBid=Bid;
Something like that, check spelling, I was writing directly in the browser
Reason: