Sorry for asking these, this is weird for some person. But after asking some modification, it bcomes un-workable. May b i am not coder and screw up all things finally.
Post your code . . .
I need to say thanks to RaptorUK looking into this. And thanks symr & WHRoeder for previous post, unfortunately i failed to add in their code into this EA. I keep on seeing compile failure. I am Zero on coding...
Below code is a Buy EA which open 10X Buy 1lot in a row. Once they TP or SL, it place another 10X orders... (This is what i need). But I need another thing is control number of orders IN A DAY. Example, if i put Max Trade OF THE DAY = 50. Then, this script will maxim place 10X orders for only 5 TIMES in one day. I need that line of code...
It dont need any magic number, (0) will be ok. Everytime only one curreny traded. Can RaptorUK (Or any others) direct addon those script in below code. I am afraid of failure compile. Many thanks
// simpleopenbuy.mq4
//
//--------------------------------------------------------------------
extern double lots = 1;
extern double TakeProfit = 20;
extern double Stoploss = 17;
extern double MaxOpenOrders = 10;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
// Special function start()
{ // Opening BUY
OrderSend(Symbol(),OP_BUY,lots,Ask,3,Bid-Stoploss*Point,Bid+TakeProfit*Point);
return; // Exit start()
I need to say thanks to RaptorUK looking into this.
Sorry I think you misunderstood . . . I'm not looking into this for you, was just suggesting that you post your code . . . didn't realise that you had already in other posts and had already been offered help.
I've already been battling all day with my own code.
//////////////////////////////////// // ?? ????? // //////////////////////////////////// #include <stdlib.mqh> //EXTERNAL extern double LOT = 1.0; extern int SELL_SL = 20; extern int SELL_TP = 30; extern int SELL_N_TIMES = 3; //GLOBAL double USE_POINT; //////////////////////////////////////////////////// int init() { USE_POINT=GET_DIGITS(Symbol()); } //////////////////////////////////////////////////// int start() { if (Bars < 100) { Comment("GET ME MORE BARS"); return (0); } if (SELL_N_TIMES > 0) { SELL_N_TIMES--; NOW_SELL_N_TIMES(); } } //////////////////////////////////////////////////// void NOW_SELL_N_TIMES() { bool SELECT_ORDER; double SELL_STOP_LVL = Bid + SELL_SL * USE_POINT; if (SELL_SL == 0) SELL_STOP_LVL = 0; double SELL_TAKE_LVL = Bid - SELL_TP * USE_POINT; if (SELL_TP == 0) SELL_TAKE_LVL = 0; int TICKET_ORDER = -1; TICKET_ORDER = OrderSend(Symbol(), OP_SELL, LOT, Bid, 4, 0, 0, "SELL_N_TIMES_EA", 1, 0, Red); if (TICKET_ORDER > -1) { OrderSelect(TICKET_ORDER, SELECT_BY_TICKET); SELECT_ORDER = OrderModify(OrderTicket(), OrderOpenPrice(), SELL_STOP_LVL, SELL_TAKE_LVL, 0, Red); if (SELECT_ORDER == FALSE) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } else Print("OrderSend() error - ", ErrorDescription(GetLastError())); } //////////////////////////////////////////////////// int deinit() { return (0); } //////////////////////////////////////////////////// //////////////////////////////////////////////////// double GET_DIGITS(string CURRENCY) { int DIGIT = MarketInfo(CURRENCY, MODE_DIGITS); if (DIGIT == 2||DIGIT == 3) double POINT = 0.01; else if (DIGIT == 4||DIGIT ==5) POINT = 0.0001; return (POINT); } //////////////////////////////////////////////////////
- Ghosthand:
- nicwaznego:You have to adjust for 4/5 digit brokers TP, SL, AND slippage
having nothing to do.... here it is....//++++ These are adjusted for 5 digit brokers. int pips2points; // slippage 3 pips 3=points 30=points double pips2dbl; // Stoploss 15 pips 0.0015 0.00150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ if (Digits == 5 || Digits == 3){ // Adjust for five (5) digit brokers. pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
- Ghosthand:
- nicwaznego:You have to adjust for 4/5 digit brokers TP, SL, AND slippage
having nothing to do.... here it is....
Thanks NIc and WHRoeder for helping. Is OK now :)
@ Ubzen, ya, i have no attempt, i been manual trade for half decade and dont think is wise enuf to start catch up learning code now. Just simply need a semi auto scrpt on some works. btw thanks too
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Sorry for asking these, this is weird for some person. But after asking some modification, it bcomes un-workable. May b i am not coder and screw up all things finally.
Can anyone pls help to write a simple script that :
Once switch on the eA/Script, it will place SELL orders immediately with 1lot, and keep on placing same orders until use up margin.
And limit the total orders of the day in X(variable) numbers. SL and TP also X(variable). Nothing more needed.
Thanks for anyone that help on this.