[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 903

 

I've learned how to insert into Alert (GetLastError()); I have managed to correct errors, but I can't cope with error 130!!!! The error is wrong stops.

Ask-stoploss *Point in a buy order, here from the bottom price I deduct the stoploss multiplied by the point, which gives the number of points down,

in case of a sell order quite the opposite - Bid+stoploss*Point. Everything is absolutely correct and correct!!!!!!!!

Stoploss is in its place in the function, I've counted it from the back and front! I tried different sizes!

I'M IN STUPIDS!!!!!

Help me!!!!!!!!!!

 
//+------------------------------------------------------------------+
//| Dimon's Borders .mq4 |
//| Copyright © 2010, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, MetaQuotes Software Corp.
#property link "http://www.metaquotes.net"

//+------------------------------------------------------------------+
//| expert initialisation function |
//+------------------------------------------------------------------+
extern int BandsPeriod=20,i=1 ;extern int BandsShift=0;
extern double BandsDeviations=2.0;
extern double Lots=0.1,TakeProfit=50,stoploss=10;
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialisation function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{double Average,Verhnyayaghranytsa,Nyzhnyayaghranytsa,newres,sum,deviation;
string text; int ticket; int err;
text="macd sample";
Average=iMA(NULL,0,BandsPeriod,BandsShift,MODE_SMA,PRICE_CLOSE,i);
//----
newres=Close[i]-Average;
sum=newres*newres;


deviation=BandsDeviations*MathSqrt(sum/BandsPeriod);
Verhnyayaghranytsa=Average+deviation;
Nyzhnyayaghranytsa=Average-deviation;
//----
if (Verhnyayaghranytsa<Close[i])
{ Comment(" buoy! ",Verhnyayaghranytsa );
ticket=OrderSend(Symbol(),OP_BUY,Lots,Bid,3,Ask-stoploss*Point,Bid+TakeProfit*Point, "macd sample",16384,0,Green);

}


if (Nyzhnyayaghranytsa>Close[i])
{ Comment(" sell! ",Nyzhnyayaghranytsa );

ticket=OrderSend(Symbol(),OP_SELL,Lots,Ask,3,Bid+stoploss*Point,Ask-TakeProfit*Point, "macd sample",16384,0,Red);
Alert (GetLastError());

}
return(0);
}
//+------------------------------------------------------------------+
 
In general, I changed asks and bids any way I wanted, but it's still the same - 130!
 
Dimka-novitsek:
In general, I changed asks and bids any way I wanted, but it's still the same - 130!

You should also check for StopLevel as well.
 
What's this????
 
Vinin:
 IndicatorShortName("");
   SetIndexLabel(0, "");
   SetIndexLabel(1, "");
   SetIndexLabel(5, "");
   SetIndexLabel(6, "");

Thank you very much, 90% helped - there are still zeros, but they generally don't interfere and don't overlap much with the indicator!!!!


 
Dimka-novitsek:
What is this????

double MarketInfo( string symbol, int type)

Returns various information about the financial instruments listed in Market Watch. Part of the information of the current financial instrument is stored in predefined variables.

MODE_STOPLEVEL 14 Minimum allowable stop loss/stake profit level in pips

 
Of course, I asked it 10 points, 20 points, 30 points, 50 points.
 
Dimka-novitsek:
And what is this????

you have :ticket=OrderSend(Symbol(),OP_BUY,Lots,Bid,3,Ask-stoploss*Point,Bid+TakeProfit*Point, "macd sample",16384,0,Green);

we need: ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-stoploss*Point,Ask+TakeProfit*Point, "macd sample",16384,0,Green);

and change here: ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+stoploss*Point,Bid-TakeProfit*Point, "macd sample",16384,0,Red);

 
Thank you!!! Wow, that's hilarious!