Download MetaTrader 5

Closing rule is not function!! Please advice

To add comments, please log in or register
Publish the program in the Market and sell it to millions of traders!
Bluefriday
19
Bluefriday 2016.11.24 10:03 
I modified the closing rule of this EA based on closing rule. However, it's not function. Could any one suggest what I have done wrong? Thank you so much.
Files:
whroeder1
14470
whroeder1 2016.11.24 13:52  
Bluefriday: I modified the closing rule of this EA based on closing rule. However, it's not function. Could any one suggest what I have done wrong? Thank you so much.
  1. "You modified X based on X." Babble
  2. "it's not function."  "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
  3. if(OrdersTotal()==0)
    Using OrdersTotal directly and/or no Magic number filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.) Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forum
  4. NewOrder=OrderSend(Symbol(),OP_BUY,Start_Lot_Size,Ask,slippage,0,0,"Long "+Magic_Number,Magic_Number,0,clrBlue);
    NewOrder=OrderSend(Symbol(),OP_SELL,Start_Lot_Size,Bid,slippage,0,0,"Short "+Magic_Number,Magic_Number,0,clrRed);
    Check your return codes and find out why. What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
  5. if(OrderProfit()<(Start_Step_Size*Point)*-2)
    What does $23.00 <  0.0123 mean? Currency vs distance is meaningless.
    • You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
    • Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the SPREAD, and DeltaPerLot is usually around $10/pip)
    • Do NOT use TickValue by itself - DeltaPerLot
    • You must normalize lots properly and check against min and max.
    • You must also check FreeMargin to avoid stop out
Bluefriday
19
Bluefriday 2016.11.24 14:59  
whroeder1:
  1. "You modified X based on X." Babble
  2. "it's not function."  "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
  3. if(OrdersTotal()==0)
    Using OrdersTotal directly and/or no Magic number filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.) Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forum
  4. NewOrder=OrderSend(Symbol(),OP_BUY,Start_Lot_Size,Ask,slippage,0,0,"Long "+Magic_Number,Magic_Number,0,clrBlue);
    NewOrder=OrderSend(Symbol(),OP_SELL,Start_Lot_Size,Bid,slippage,0,0,"Short "+Magic_Number,Magic_Number,0,clrRed);
    Check your return codes and find out why. What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
  5. if(OrderProfit()<(Start_Step_Size*Point)*-2)
    What does $23.00 <  0.0123 mean? Currency vs distance is meaningless.

Thank you.  I mean I change the closing rule to my closing rule since the original one doesn't perform as I want.

I am not a programmer and trying to learn. I'll try to recode what you said because I'm not fully understand all you said. Thank you.

Bluefriday
19
Bluefriday 2016.11.25 04:21  

I made changed based on whroeder1's suggestion. But EA still not close the positions. I'm not sure if I've done it correctly. Any further recommend for this issue? Thanks.

Files:
Keith Watford
Moderator
9603
Keith Watford 2016.11.25 07:23  
Why don't you show the section of code that worked as expected before you changed it. Then show the code after you changed it.
To add comments, please log in or register