Joined: Wed Mar 14, 2012 12:31 am Posts: 118
|
molanisfx wrote: Do you want to close the trades when? on thursday? on friday? At what time? Sorry, I thought the answer to your question was provided in the code that I posted. The above code attempts to: Close the position Monday through Thursday, at 23:57. Close the position on Friday, at 21:57. Open the position Monday through Friday, between 00:00 through 00:05. This is the MQL block connected to a Buy icon with the Time() function up front: TimeHour(TimeCurrent()) == 00 && TimeMinute(TimeCurrent()) <= 05 && ((((iCustom(Symbol(),PERIOD_M1,"iCustom", true,0,0) + iCustom(Symbol(),PERIOD_M1,"iCustom", true,1,0)) / 2) + ((iCustom(Symbol(),PERIOD_M5,"iCustom", true,0,0) + iCustom(Symbol(),PERIOD_M5,"iCustom", true,1,0)) / 2) + ((iCustom(Symbol(),PERIOD_M15,"iCustom", true,0,0) + iCustom(Symbol(),PERIOD_M15,"iCustom", true,1,0)) / 2) + ((iCustom(Symbol(),PERIOD_M30,"iCustom", true,0,0) + iCustom(Symbol(),PERIOD_M30,"iCustom", true,1,0)) / 2) + ((iCustom(Symbol(),PERIOD_H1,"iCustom", true,0,0) + iCustom(Symbol(),PERIOD_H1,"iCustom", true,1,0)) / 2) + ((iCustom(Symbol(),PERIOD_H4,"iCustom", true,0,0) + iCustom(Symbol(),PERIOD_H4,"iCustom", true,1,0)) / 2) + ((iCustom(Symbol(),PERIOD_D1,"iCustom", true,0,0) + iCustom(Symbol(),PERIOD_D1,"iCustom", true,1,0)) / 2)) / 7) > 50This is the MQL block connected to a CL icon: Day() == 1 || Day() == 2 || Day() == 3 || Day() == 4 && TimeHour(TimeCurrent()) >=23 && TimeMinute(TimeCurrent()) >=57 || Day() == 5 && TimeHour(TimeCurrent()) >=21 && TimeMinute(TimeCurrent()) >=57The Buy code works only once (when you click the Tester Start button for the first time). The Close code never works at all. Subsequently, no Buy code ever works after the first trade. Thanks. cfx
|
|