/  Forum 

A Method of Drawing the Support/Resistance Levels This article describes the process of creating a simple script for detecting the support/resistance levels. It is written for beginners, so you can find the detailed explanation of every stage of the process. However, though the script is very simple, the article will be also useful for advanced traders and the users of the MetaTrader 4 platform. It contains the examples of the data export into the tabular format, the import of the table to Microsoft Excel and plotting the charts for the further detailed analysis. 
1936 

1936 
M Use http://docs.mql4.com/constants/marketinfo with the MODE_STOPLEVEL NB  This will be in the pipsize of the broker 

I have a similar problem. I have error 130 and I can't track down why. I would really appreciate some pointers. I've checked the following... The SL is delivered as a real price rather than pips away. It's the correct format... a double and it's been normalised. It's the correct figure.... confirmed by print in the line above the ordersend. It's an allowable distance ~50pips It's not the Boston Technologies Bridge refered to in another thread double sl=NormalizeDouble(shortstop,Digits); Alert ("SL ", sl, " Bid ",Bid ); OrderSend(Symbol(),OP_SELL,lot,Bid,slip,sl, target); I get Alert: SL 1.4255 Bid 1.4201 I have run out of ideas of where to look next... thanks for any help V 

Viffer:
I have a similar problem. I have error 130 and I can't track down why. I would really appreciate some pointers. I've checked the following... The SL is delivered as a real price rather than pips away. It's the correct format... a double and it's been normalised. It's the correct figure.... confirmed by print in the line above the ordersend. It's an allowable distance ~50pips It's not the Boston Technologies Bridge refered to in another thread I get Alert: SL 1.4255 Bid 1.4201 I have run out of ideas of where to look next... thanks for any help V TP could be causing the stops error. What's the value of target? CB 


mark1808 wrote >> By trail and error, I found that the minimum the value of Limit could be is 30 (3 whole pips). Not sure if this is different for other brokers. Is there any function that tells you the distance that the limit order needs to be placed away? // A pending order price can be no closer to the current price, than this // amount. On IBFX it's equal to 30 (3.0 pips.) A TP or SL, can be no // closer to the order price (open, limit, or stop) or closing price (filled double // order) than this amount. minGap.stops = MarketInfo( Symbol(), MODE_STOPLEVEL )*Point;Likewise, your constants should be given in pips not points and internally adjusted so it works on any broker. // These are adjusted for 5 digit brokers. double pips2points, // slippage 3 pips 3=points 30=points pips2dbl; // Stoploss 15 pips 0.0015 0.00150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init() { pips2dbl = Point; pips2points = 1; Digits.pips = 0; // reInit if (Digits == 3  Digits == 5) { pips2points *= 10; pips2dbl *= 10; Digits.pips++; } //...Also remember for OP_SELL the SL is relative to the Ask price, so it appears on the chart at 3+2(spread) or 50 points at least from the Bid. 

Hi! I've got some similar problem with an order of type Instant Market Sell . It seems I can get help here I wrote a sample expert adviser and the problem is this part : double p = Bid; int tN = OrderSend(Symbol(),OP_SELL,0.1,p,50,NormalizeDouble(p+1000*Point,Digits),0); if(tN > 0){ Alert("Done"); }else{ Alert(ErrorDescription(GetLastError())); } This alerts "invalid stops". But an order of type OP_SELLLIMIT with exactly same parameters executes with no problem. I tried different values for stop loss, ranging from 0Points to 1000Points and different slippages. I'm using a demo account with spread 0 and MarketInfo(Symbol(),MODE_STOPLEVEL) returns 0 Help me please! Thanks a lot 

Nima: I've got some similar problem with an order of type Instant Market Sell . It seems I can get help here


Thanks for your reply. But this code has got the same problem. I used your code and just replaced Slippage.Pips with an integer value, same error raised after executing. For learning purpose, I want to write a simple expert which sends just one instant sell or buy order, and I want to adjust everything according to parameters queried from broker. Any advice? 
Hi,
I know there are similar questions to this one elsewhere on the forum, but none of them seem to solve the problem with my script. I am fairly new to MQL4, so I'm not sure if there's something obvious that I'm doing wrong.
I have simplified my problem down to placing a simple limit order. Whenever I try to place an OP_BUYLIMIT order, I get the error #130. I am using the Alpari UK Demo account. This is my code....
int Limit = 10;
int stoploss = 2000;
int takeprofit = 2000;
double BuyLimitPrice = Ask(Limit*Point);
double StopPrice = Ask((Limit+stoploss)*Point);
double TakeProfitPrice = Ask+((Limit+takeprofit)*Point);
Print(BuyLimitPrice + " Stop: " + StopPrice + " TakeProfit: " + TakeProfitPrice);
int ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.1,NormalizeDouble(BuyLimitPrice,Digits),5,NormalizeDouble(StopPrice,Digits),NormalizeDouble(TakeProfitPrice,Digits),"LimitTest",0,0,Blue);
I have been testing it on GBPUSD and get the following output:
2010.01.18 10:18:47 2009.12.30 23:59 LimitTesting GBPUSD,H1: OrderSend error 130
2010.01.18 10:18:47 2009.12.30 23:59 LimitTesting GBPUSD,H1: 1.60740000 Stop: 1.58740000 TakeProfit: 1.62740000
I have placed the stoploss and take profit values a fair distance away from the current price and the limit order price, so I'm sure there must be something else wrong.
I have also tried setting the stoploss and take profit values to zero, and this gives the same error.
Any help would be greatly appreciated. Thanks in advance.
Mark