Try this simple one. May be it will work for you. I haven't tried it though.
//+------------------------------------------------------------------+ //| TestScript.mq4 | //| Copyright © 2010, Makala Corp. | //| http://www.makala.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2010, Makala Corp." #property link "http://www.makala.net" //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { //------------------------------------------------------------------+ //Input constants double Lots = 1.0; //Lot size double BidLevel = 1.4501; //Triger Bid Level //--------------- { //BUY triger if(Bid > BidLevel) { OrderSelect(SELECT_BY_POS, MODE_TRADES); OrderClose(OrderTicket(),OrderLots(),Bid,5,Magenta); // close short position OrderSend(Symbol(),OP_BUY,Lots,Ask,5,0,0,"expert comment",255,0,CLR_NONE); Alert(GetLastError()); return; } //---- //SELL Triger if(Bid < BidLevel) { OrderSelect(SELECT_BY_POS, MODE_TRADES); OrderClose(OrderTicket(),OrderLots(),Ask,5,Magenta); // close long position OrderSend(Symbol(),OP_SELL,Lots,Bid,5,0,0,"expert comment",255,0,CLR_NONE); Alert(GetLastError()); return; } //---- } //---- return(0); } //+------------------------------------------------------------------+
if (OrderSelect(0, SELECT_BY_POS, MODE_TRADES)) { OrderClose(OrderTicket(),... RefreshRates(); }

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
how do this script:
example:
GBP/USD
no indicator
lot:1
if BID above 1.4501 be LONG 1 lot,
then if BID below 1.4501 close LONG and go SHORT 1lot (or vice versa).
the script must always keep 1 open position(1lot) LONG or SHORT if BID is >1.4501 or <1.4501.
thanks a lot.