muruku Posted September 22, 2010 Report Share Posted September 22, 2010 that meant your broker never allow you not to set tp & sl ... do your own coding pls. Thank you Muruku... i have got this error 2010.09.22 17:02:21 '2006005': order sell limit 0.10 GBPUSD opening at 1.56702 sl: 0.00000 tp: 0.00000 failed [invalid S/L or T/P] 2010.09.22 16:46:35 '2006005': order sell limit 0.10 GBPUSD opening at 1.56805 sl: 0.00000 tp: 0.00000 failed [invalid S/L or T/P] what can i do to solve it ? and can you please if you have the newest version with 5digits broker can you share ? Thank you stijjn 1 Quote Link to comment Share on other sites More sharing options...
azam575 Posted September 22, 2010 Report Share Posted September 22, 2010 muruku, your MOD is the best :D .... hehehe your 2 instances idea is the best.. i will do it ASAP :D Thanks again stijjn 1 Quote Link to comment Share on other sites More sharing options...
eggzactly Posted September 22, 2010 Report Share Posted September 22, 2010 (edited) Hi, After testing some ideas, seems a dynamic Step and Dynamic Profit becomes real good in real market. The ideas behind this is to have different levels for entry orders, for instance on may 2010 we have like 250 pips daily average, so if we stick with our 17 step level, maybe no good for market conditions, and on April we have 100 pips, so dynamic i think is a important key rule here. Define the Step for the ATRpips value of daily or even weekly data. Define the Profit based on the Steps, if we have a step of 30 we don´t want 5 pips, we want more to get the possible range. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Instead of running multiple instances of the EA you can code inside the EA for Profitable Hours, Normal Hours, etc... For instance if(Profitable_Hours) Lots = ProfitableLots ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Regarding the magic number, even if you put different one the broker can cheat you, the key is the comment, in earlier post i put the code for the comment, i have update it in order to be more easy so people can put it on the codes : Replace in the order send function the comment by this Comment_Code() Put this code at the end of the EA string Comment_Code() { string Text[550]; Text[0]="abc1"; Text[1]="def2 "; Text[2]="ghi3 "; Text[3]="jkl4 "; Text[4]="mno5 "; Text[5]="bqr6 "; Text[6]="stu7 "; Text[7]="vwx8 "; Text[8]="yz90 "; Text[9]="nine "; Text[10]="ten0 "; Text[11]="eleven "; Text[12]="twelve "; Text[13]="thirteen "; Text[14]="fourteen "; Text[15]="fifteen "; Text[16]="sixteen "; Text[17]="seventeen "; Text[18]="eighteen "; Text[19]="nineteen "; Text[20]="twenty " ; Text[21]="twenty1 "; Text[22]="twenty2 "; Text[23]="twenty3 "; Text[24]="twenty4 "; Text[25]="twenty5 " ; Text[26]="twenty6 "; Text[27]="twenty7 "; Text[28]="twenty8 "; Text[29]="twenty9 "; Text[30]="thirty "; Text[31]="thirty1 "; Text[32]="thirty2"; Text[33]="thirty3"; Text[34]="thirty4 "; Text[35]="thirty5 "; Text[36]="thirty6 "; Text[37]="thirty7 "; Text[38]="thirty8 "; Text[39]="thirty9 "; Text[40]="forty "; Text[41]="forty1 "; Text[42]="forty2 "; Text[43]="forty3 "; Text[44]="forty4 "; Text[45]="forty5 "; Text[46]="forty6 "; Text[47]="forty7 "; Text[48]="forty8 "; Text[49]="forty9 "; Text[50]="fifty "; Text[100]= "hundred"; Text[150]="hundred&fifty"; Text[200]="2hundred "; Text[250]="2hundred&fifty "; Text[300]="3hundred"; Text[350]="3hundred&fifty"; Text[400]="4hundred "; Text[450]="4hundred&fifty "; Text[500]="5hundred"; for (int i=500; i>=50 ; i=i-50) { for (int j=49;j>=0;j--) { if (Open[j] == Close[j] ) break; } } Text[i+j]=Text + Text[j]; return(Text[i+j]); } Hope this helps in this task regards, eggzactly Edited September 22, 2010 by eggzactly beorn, azam575, domonkos and 1 other 4 Quote Link to comment Share on other sites More sharing options...
eggzactly Posted September 22, 2010 Report Share Posted September 22, 2010 Hi, Seems can optimize the EA to takeprofit with other option like single trade profit, by usd, by total profit in pips, etc.... This one i tested and seems works great, can choose different ways to show profit : enjoy double TotalProfit(int pmode, int magic) { int total = OrdersTotal(); double Pips = 0, profit=0, totalPips = 0, totalProfits = 0; for (int cnt=0;cnt<total;cnt++) { OrderSelect(cnt, SELECT_BY_POS); int mode=OrderType(); bool condition = false; if ( magic>0 && OrderMagicNumber()==magic && OrderSymbol() == Symbol()) condition = true; else if ( magic==0 ) condition = true; if (condition) { switch (mode) { case OP_BUY: Pips = (MarketInfo(Symbol(),MODE_BID)-OrderOpenPrice())/_Point; profit = OrderProfit() + OrderSwap() + OrderCommission(); totalPips += Pips; totalProfits += profit; break; case OP_SELL: Pips = (OrderOpenPrice()-MarketInfo(Symbol(),MODE_ASK))/_Point; profit = OrderProfit() + OrderSwap() + OrderCommission(); totalPips += Pips; totalProfits += profit; break; } } } if(pmode==0) return(Pips); else if(pmode==1) return(profit); else if(pmode==2) return(totalPips); else if(pmode==3) return(totalProfits); } regards, eggzactly beorn, shady2500, domonkos and 2 others 5 Quote Link to comment Share on other sites More sharing options...
stijjn Posted September 22, 2010 Report Share Posted September 22, 2010 Ok guys, thanks to all the work you put in to this. But I don't understand a thing about all these codes you post. I realy want this ea with everything on it but you will not post it so you leave me no other choise to begin studying MQL language. Are there any good sites for start learning MQL? Thanks; Stijn. Quote Link to comment Share on other sites More sharing options...
prattpot Posted September 22, 2010 Report Share Posted September 22, 2010 (edited) It would be lovely if someone can assist us who don't have the understanding and post the EA with modifications and broker protection. I am assuming that modifications are made with the Meta Editor but where coding is placed is a mystery. If you feel that we are not worthy then please point us in the direction where we can learn without being so forward requesting assistance. Edited September 22, 2010 by prattpot Quote Link to comment Share on other sites More sharing options...
muruku Posted September 23, 2010 Report Share Posted September 23, 2010 eggzactly, i need a pcs of logic to delete duplication pending orders (entry with same pending buy/sell price) if misfired by EA or broker server turned up to be hair-wired a bit... I placed a logic to prevent this to be happened as below, but i need a backup logic to wipe up unwanted AFTER if the mentioned duplicated entries HAD happened. if ((gd_124 - Bid <= 5.0 * Point) && (LastSellPrice != gd_124)) { NewOrder(OP_SELLLIMIT, g_ord_lots_108 + IncLot,NextSLStep,0,0); LastSellPrice = gd_124;} if ((Ask - gd_132 <= 5.0 * Point) && (LastBuyPrice != gd_132)) { NewOrder(OP_BUYLIMIT, g_ord_lots_116 + IncLot,NextBLStep,0,0); LastBuyPrice = gd_132;} Quote Link to comment Share on other sites More sharing options...
ryujin Posted September 23, 2010 Report Share Posted September 23, 2010 Hi eggzactly, I have insert your codes into the EA and have a warning when compiling the EA. Function "TotalProfit" is not referenced and will be remove from exp-file Is this expected? Quote Link to comment Share on other sites More sharing options...
⭐ pipmaster Posted September 23, 2010 Report Share Posted September 23, 2010 Been trying cable run on the AU and seems to work but would need to test it Quote Link to comment Share on other sites More sharing options...
muruku Posted September 23, 2010 Report Share Posted September 23, 2010 bud, you have to brush out your mq4 scripting skill. Do you think codes supplied here is plug & play ? Hi eggzactly, I have insert your codes into the EA and have a warning when compiling the EA. Function "TotalProfit" is not referenced and will be remove from exp-file Is this expected? Quote Link to comment Share on other sites More sharing options...
ryujin Posted September 23, 2010 Report Share Posted September 23, 2010 bud, you have to brush out your mq4 scripting skill. Do you think codes supplied here is plug & play ? Hi muruku, I am still learning the Mq4. Are you able to advise me what is wrong? Thanks Quote Link to comment Share on other sites More sharing options...
arconite Posted September 23, 2010 Report Share Posted September 23, 2010 muruku, what are your logics to trade during London open? The move is crazy and the market can sometimes go one way until closing. Quote Link to comment Share on other sites More sharing options...
Guest hftlh Posted September 23, 2010 Report Share Posted September 23, 2010 you will get killed trading london open. Quote Link to comment Share on other sites More sharing options...
herbseason Posted September 23, 2010 Report Share Posted September 23, 2010 Good pips just that open many trades, anyone can share how to limit number of trades? Quote Link to comment Share on other sites More sharing options...
ryujin Posted September 23, 2010 Report Share Posted September 23, 2010 Hi muruku, I have managed to resolve the problems. Thanks for all the mods. Quote Link to comment Share on other sites More sharing options...
⭐ pipmaster Posted September 23, 2010 Report Share Posted September 23, 2010 Does anyone know the ideal trading hours for this EA? Or Muruku is it possible to upload a modified version with the recommended trading hours set. I turned off the close trades option as closed off two trades at a loss when would have came back. Quote Link to comment Share on other sites More sharing options...
eggzactly Posted September 23, 2010 Report Share Posted September 23, 2010 (edited) eggzactly, i need a pcs of logic to delete duplication pending orders (entry with same pending buy/sell price) if misfired by EA or broker server turned up to be hair-wired a bit... I placed a logic to prevent this to be happened as below, but i need a backup logic to wipe up unwanted AFTER if the mentioned duplicated entries HAD happened. if ((gd_124 - Bid <= 5.0 * Point) && (LastSellPrice != gd_124)) { NewOrder(OP_SELLLIMIT, g_ord_lots_108 + IncLot,NextSLStep,0,0); LastSellPrice = gd_124;} if ((Ask - gd_132 <= 5.0 * Point) && (LastBuyPrice != gd_132)) { NewOrder(OP_BUYLIMIT, g_ord_lots_116 + IncLot,NextBLStep,0,0); LastBuyPrice = gd_132;} Hi, Maybe this works, need more testing : Check Limit Orders // --- Check Limit Positions void CheckLimitPositions() { SelllimitOrderTicket=0; BuylimitOrderTicket=0; SelllimitOrders=0; BuylimitOrders=0; LastSellPrice = FindLastSellPrice(magic); LastBuyPrice = FindLastBuyPrice (magic); for (int cnt = OrdersTotal() - 1; cnt >= 0; cnt--) { if (OrderSelect(cnt, SELECT_BY_POS,MODE_TRADES)) { if (OrderSymbol() == Symbol() && OrderMagicNumber() == magic) { switch (OrderType()) { case OP_SELLLIMIT: SelllimitOrders++; SelllimitOrderTicket = OrderTicket(); SelllimitOrderOpenPrice = OrderOpenPrice(); if(HasOpenPosition && Trades <= MaxCountOrders) { if ( SelllimitOrderOpenPrice != LastSellPrice ) { int tmp1= OrderModify(SelllimitOrderTicket,SelllimitOrderOpenPrice + StepLevels * _Point,0,0,0,CLR_NONE); if (tmp1<0) Print("Modify SELLLimit: " + GetLastError()); } } break; case OP_BUYLIMIT: BuylimitOrders++; BuylimitOrderTicket = OrderTicket(); BuylimitOrderOpenPrice = OrderOpenPrice(); if(HasOpenPosition && Trades <= MaxCountOrders) { if ( BuylimitOrderOpenPrice != LastBuyPrice ) { int tmp3= OrderModify(BuylimitOrderTicket,BuylimitOrderOpenPrice - StepLevels * _Point,0,0,0,CLR_NONE); if (tmp3<0) Print("Modify BuyLimit: " + GetLastError()); } } }//end switch }//end if order symbol }//end if select orders }// end for }//end main Check Lot Seems This Works I have in my EA 2 levels of trading, this is : 5 Trades with Step - First Lot = 1stLevelLots 3 Trades with Step * 3 - IncLot = 2stLevelLots_x - this is the multiply of FirstLots If Lot is not correct, then Delete the Limit Order // --- Lot Filter Delete Limit Order void LotFilterOnDeleteLimit() { double newlot; for (int i = OrdersTotal() - 1; i >= 0; i--) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() == Symbol() && OrderMagicNumber() == magic && OrderCloseTime() == 0) { if (OrderType() == OP_BUYLIMIT) { if(Trades <= _1stLevel_MaxOrders) { newlot = _1stLevelLots; if (newlot != _1stLevelLots) OrderDelete (OrderTicket()); } else if(Trades > _1stLevel_MaxOrders && Trades <= _2stLevel_MaxOrders) { newlot = _1stLevelLots * _2stLevelLots_X; if (newlot == _1stLevelLots) OrderDelete (OrderTicket()); } } if (OrderType() == OP_SELLLIMIT) { if(Trades <= _1stLevel_MaxOrders) { newlot = _1stLevelLots; if (newlot != _1stLevelLots) OrderDelete (OrderTicket()); } else if(Trades > _1stLevel_MaxOrders && Trades <= _2stLevel_MaxOrders) { newlot = _1stLevelLots * _2stLevelLots_X; if (newlot == _1stLevelLots) OrderDelete (OrderTicket()); } } } } } regards, eggzactly Edited September 23, 2010 by eggzactly Need Further Test Or Improvements for Some GURU Coder Please muruku 1 Quote Link to comment Share on other sites More sharing options...
ryujin Posted September 23, 2010 Report Share Posted September 23, 2010 Hi muruku, I have tried your function double Pips = TotalProfit(Magic); if (Pips >= MinProfit){ CloseAllTrades(0,Magic); DeletePendingOrders(Magic); } which called the function below. int TotalProfit(int Magic) { int total=OrdersTotal(); int totalPips = 0; for (int cnt=0;cnt<total;cnt++) { OrderSelect(cnt, SELECT_BY_POS); int mode=OrderType(); bool condition = false; if (OrderMagicNumber()== Magic)condition = true; if (condition) { switch (mode) { case OP_BUY: totalPips += MathRound((MarketInfo(OrderSymbol(),MODE_BID)-OrderOpenPrice())/MarketInfo(OrderSymbol(),MODE_POINT)); break; case OP_SELL: totalPips += MathRound((OrderOpenPrice()-MarketInfo(OrderSymbol(),MODE_ASK))/MarketInfo(OrderSymbol(),MODE_POINT)); break; } } } return(totalPips); } I observe my account which is floating more than $30 in profits, but the EA still did not closed all the trades? By the way, my broker is a 5 digit no, hence, I change the value for step and MinProfit to be 170 and 150 int Step = 170; // org 17 .. still stick to 17 extern double FirstLot = 0.01; // org 0.10 .. risky .. so just put 0.1 double IncLot = 0.0; // org 0.0 double MinProfit = 150; // org 15 Would that be the cause to all orders not closed? Quote Link to comment Share on other sites More sharing options...
azam575 Posted September 23, 2010 Report Share Posted September 23, 2010 HI EGGZACTLY, this is my idea for dynamics STEP string ATRCONTROL = "=======FIBO/ATR PIP CONTROL Entry======="; bool VolatilityBasedSTEP= FALSE; double StepFactor = 0.8; double ATRIncreaseDecreaseFactor = 1.0; int ATR_Period = 20; int ATR_Timeframe = 240; start() double ld_0 = iATR(NULL, ATR_Timeframe, ATR_Period2, 0); if (Poin == 0.01) ld_0 = ATRIncreaseDecreaseFactor * (100.0 * ld_0); if (Poin == 0.0001) ld_0 = ATRIncreaseDecreaseFactor * (10000.0 * ld_0); if (VolatilityBasedSTEP) { Step= NormalizeDouble(ld_0 * StepFactor, 0); ratio = NormalizeDouble(1, 0); } what do you think ? Quote Link to comment Share on other sites More sharing options...
eggzactly Posted September 23, 2010 Report Share Posted September 23, 2010 HI EGGZACTLY, this is my idea for dynamics STEP what do you think ? Maybe one idea,i am testing a more simple one, just dividing the ATR from Daily, and then i get the step. Other possible idea is using fibo from last swing high/low, calculating from a non-repainting ZigZag - other is BB Range, there is too many ideas, but for now i just want to compile the system, have more then 1000 code lines, and need to be optimized and correct some bugs, then i can test more ideas regarding the dynamic levels and profit. Is important check the maximum trades too, and that can be dynamic too, due to the volatility of market - for now i´m using 5 trades with step level distance, then 3 trades with 3 X the step level distance. It could handle the major drops and almost catch the tops and bottoms of sudden news and breakout of market. regards, eggzactly azam575 1 Quote Link to comment Share on other sites More sharing options...
ryujin Posted September 23, 2010 Report Share Posted September 23, 2010 Hi muruku, I have tried your function double Pips = TotalProfit(Magic); if (Pips >= MinProfit){ CloseAllTrades(0,Magic); DeletePendingOrders(Magic); } which called the function below. int TotalProfit(int Magic) { int total=OrdersTotal(); int totalPips = 0; for (int cnt=0;cnt<total;cnt++) { OrderSelect(cnt, SELECT_BY_POS); int mode=OrderType(); bool condition = false; if (OrderMagicNumber()== Magic)condition = true; if (condition) { switch (mode) { case OP_BUY: totalPips += MathRound((MarketInfo(OrderSymbol(),MODE_BID)-OrderOpenPrice())/MarketInfo(OrderSymbol(),MODE_POINT)); break; case OP_SELL: totalPips += MathRound((OrderOpenPrice()-MarketInfo(OrderSymbol(),MODE_ASK))/MarketInfo(OrderSymbol(),MODE_POINT)); break; } } } return(totalPips); } I observe my account which is floating more than $30 in profits, but the EA still did not closed all the trades? By the way, my broker is a 5 digit no, hence, I change the value for step and MinProfit to be 170 and 150 int Step = 170; // org 17 .. still stick to 17 extern double FirstLot = 0.01; // org 0.10 .. risky .. so just put 0.1 double IncLot = 0.0; // org 0.0 double MinProfit = 150; // org 15 Would that be the cause to all orders not closed? Hi eggzactly, Do u think u can help with this? Quote Link to comment Share on other sites More sharing options...
eggzactly Posted September 23, 2010 Report Share Posted September 23, 2010 Hi eggzactly, Do u think u can help with this? I have post earlier a function for calculating the profit wich working for me with no problems, and i check with real and backtest and at predefined level it closes the trades. for not put again, just please do a search in my previous post and you can use that function. #post 204 regards, Quote Link to comment Share on other sites More sharing options...
azam575 Posted September 23, 2010 Report Share Posted September 23, 2010 Is important check the maximum trades too, and that can be dynamic too, due to the volatility of market - for now i´m using 5 trades with step level distance, then 3 trades with 3 X the step level distance. It could handle the major drops and almost catch the tops and bottoms of sudden news and breakout of market. could you share the code ? Quote Link to comment Share on other sites More sharing options...
eggzactly Posted September 23, 2010 Report Share Posted September 23, 2010 could you share the code ? Global Variables extern string M3 = " Trade Levels & Lots"; extern int StepLevels = 17; // Step Amount Levels Dynamic extern string Level1 = " 1st Level Options"; extern double _1stLevelLots = 0.1; // 1st Level Volume Multiply extern int _1stLevel_MaxOrders = 5; // Max Orders Number extern string Level2 = " 2st Level Options"; extern double _2stLevelLots_X = 5.0; // 2st Level Volume Multiply extern int _2stLevel_MaxOrders = 10; // Max Orders Number extern double _2stLevel_Distance_X = 3.0; //Multiply Level from 1st Level Steps void DoTrading () { RefreshRates(); // --- 1st Trades if (timecond && Trades == 0 && ATR_Signal() == 1) { double Ask_ = Ask; double Bid_ = Bid; OpenPendingOrder(0, _1stLevelLots , Ask_ - StepLevels * _Point, Slippage, Ask_ - StepLevels * _Point, StopLoss, 0, Comment_Code(), magic, 0, CLR_NONE); OpenPendingOrder(1, _1stLevelLots , Bid_ + StepLevels * _Point, Slippage, Bid_ + StepLevels * _Point, StopLoss, 0, Comment_Code(), magic, 0, CLR_NONE); } // --- 2st Trades if (Trades > 0 && Trades <= _1stLevel_MaxOrders && timecond || !timecond ) { LastSellPrice = FindLastSellPrice(magic); LastBuyPrice = FindLastBuyPrice (magic); if (Ask - LastBuyPrice <= 5.0 * Point ) { OpenPendingOrder(0, _1stLevelLots, LastBuyPrice - StepLevels * _Point, Slippage, LastBuyPrice - StepLevels * _Point, StopLoss, 0, Comment_Code(), magic, 0, CLR_NONE); } if (LastSellPrice - Bid <= 5.0 * Point ) { OpenPendingOrder(1, _1stLevelLots, LastSellPrice + StepLevels * _Point, Slippage, LastSellPrice + StepLevels * _Point, StopLoss, 0, Comment_Code(), magic, 0, CLR_NONE); } } // --- 3st Trades if (Trades > _1stLevel_MaxOrders && Trades <= _2stLevel_MaxOrders && timecond || !timecond ) { LastSellPrice = FindLastSellPrice(magic); LastBuyPrice = FindLastBuyPrice (magic); if (Ask - LastBuyPrice <= 5.0 * Point ) { OpenPendingOrder(0, _2stLevelLots_X * _1stLevelLots, LastBuyPrice - (StepLevels * _2stLevel_Distance_X) * _Point, Slippage, LastBuyPrice - (StepLevels * _2stLevel_Distance_X) * _Point, StopLoss, 0, Comment_Code(), magic, 0, CLR_NONE); } if (LastSellPrice - Bid <= 5.0 * Point ) { OpenPendingOrder(1, _2stLevelLots_X * _1stLevelLots, LastSellPrice + (StepLevels * _2stLevel_Distance_X) * _Point, Slippage, LastSellPrice + (StepLevels * _2stLevel_Distance_X) * _Point, StopLoss, 0, Comment_Code(), magic, 0, CLR_NONE); } } } OpenPendingOrder function // --- Open Pending Order int OpenPendingOrder(int order_code, double Lots, double entry_price, int slippage, double price_stoploss, int stoploss, int takeprofit, string _comment, int magic, int expiration, color clr) { int order_ticket = 0; int error_ = 0; int cnt = 0; int numords = 100; switch (order_code) { case 0: for (cnt = 0; cnt < numords; cnt++) { order_ticket = OrderSend(Symbol(), OP_BUYLIMIT, Lots, entry_price, slippage, StopLong(price_stoploss, stoploss), TakeLong(entry_price, takeprofit), _comment, magic, expiration, clr); error_ = GetLastError(); if (error_ == 0/* NO_ERROR */) break; if (!((error_ == 4/* SERVER_BUSY */ || error_ == 137/* BROKER_BUSY */ || error_ == 146/* TRADE_CONTEXT_BUSY */ || error_ == 136/* OFF_QUOTES */))) break; Sleep(1000); } break; case 1: for (cnt = 0; cnt < numords; cnt++) { order_ticket = OrderSend(Symbol(), OP_SELLLIMIT, Lots, entry_price, slippage, StopShort(price_stoploss, stoploss), TakeShort(entry_price, takeprofit), _comment, magic, expiration, clr); error_ = GetLastError(); if (error_ == 0/* NO_ERROR */) break; if (!((error_ == 4/* SERVER_BUSY */ || error_ == 137/* BROKER_BUSY */ || error_ == 146/* TRADE_CONTEXT_BUSY */ || error_ == 136/* OFF_QUOTES */))) break; Sleep(1000); } } return (order_ticket); } // --- Stop Long double StopLong(double price, int StopLoss_Amount) { if (StopLoss_Amount == 0) return (0); return (price - StopLoss_Amount * _Point); } // --- Stop Short double StopShort(double price, int StopLoss_Amount) { if (StopLoss_Amount == 0) return (0); return (price + StopLoss_Amount * _Point); } // --- TakeProfit Long double TakeLong(double price, int StopLoss_Amount) { if (StopLoss_Amount == 0) return (0); return (price + StopLoss_Amount * _Point); } // --- TakeProfit Short double TakeShort(double price, int StopLoss_Amount) { if (StopLoss_Amount == 0) return (0); return (price - StopLoss_Amount * _Point); } hope this help regards, azam575 1 Quote Link to comment Share on other sites More sharing options...
ryujin Posted September 23, 2010 Report Share Posted September 23, 2010 I have post earlier a function for calculating the profit wich working for me with no problems, and i check with real and backtest and at predefined level it closes the trades. for not put again, just please do a search in my previous post and you can use that function. #post 204 regards, Hi eggzactly, I have insert your codes inside the EA. Just want to check with you if I am correct in the EA variables declaration and the function int pmode; double Pips = TotalProfit(pmode,Magic); if (Pips >= MinProfit){ CloseAllTrades(0,Magic); DeletePendingOrders(Magic); } Do I need to put CloseAllTrades(1, Magic); CloseAllTrades(2, Magic); Since this is declare on top inside the init start() What does CloseAllTrades(1, Magic); , CloseAllTrades(2, Magic); and CloseAllTrades(0, Magic); means? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.