stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Coin-Flip EA v2.0
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3765
Page 10 of 19
Author:  acs [ Mon Aug 11, 2014 10:55 am ]
Post subject:  Coin-Flip EA v2.0

got error forward testing EAv26

Experts error log

10:54:43 CoinFlip EA V26R EURUSD,H1: initialized
11:00:00 CoinFlip EA V26R EURUSD,H1: trade operations not allowed by settings
11:00:00 CoinFlip EA V26R EURUSD,H1: OrderSend function error = 0

orders with the broker have to be sperate, they will not let you send order+SL+TP with one command
you send order first and then modify order, at least I think that is what the problem is here.

acs
Author:  xmess7 [ Mon Aug 11, 2014 12:30 pm ]
Post subject:  Coin-Flip EA v2.0

Question, what is the margin required for 27.46 lots? In order to find out. Go on Demo and try to buy or sell 1.0 lots, Once the trade is made look at Terminal window below the chart and find the value next to Margin. I ran into the same problem while testing a $10K demo. The problem is that when the SL gets smaller the lotsize gets bigger. The Lot size gets to a point where the margin required to open that size is more than the margin you have available. In your case 27.46 lots requires more margin than the $10K that is available.

Is there a solution?? Well yes LOL. It depends on how you guys want to handle it. We can have the EA recognize this situation and then have it re-do the lot calculation until it finds the right lot size which will not require more margin than what you have available. Or the EA can decrease the PercentEquity or the EA can try the HARD_SL to calculate the lotsize.... anyway, we'll figure this out when we know for sure that it's a margin issue.

Let me know.


acs » Mon Aug 11, 2014 12:47 am wrote:here is my log file from tester having run EA as downloaded (no changes to EA), it shows the reason why
it will not take any trades unless I set DynamicLots to false.

I hope this helps you solve the problem

09:29:10 Expert CoinFlip EA V26R2: loaded successfully
09:29:10 TestGenerator: spread set to 2
09:29:10 CoinFlip EA V26 inputs: BrokerGMTOffset=0; TradeCandle=2; EquityPercent=0.35; Use_ATR=1; HardTP=0; HardSL=30; DynamicLots=1; FixedLots=0.1; MagicNumber=777;
09:29:21 2014.07.21 11:00 Tester: not enough money for sell 27.46 EURUSD at 1.35235 sl: 0.00000 tp: 0.00000 [2014.07.21 11:00]
09:29:21 2014.07.21 11:00 Tester: PrevBalance: 10000.00, PrevPL: 0.00, PrevEquity 10000.00, PrevMargin: 0.00, NewMargin: 21893, FreeMargin: -11893.45
09:29:21 2014.07.21 11:00 CoinFlip EA V26R2 EURUSD,H1: OrderSend error 134
09:30:03 2014.08.01 16:18 Tester: stop button pressed
09:30:03 EURUSD,H1: 315210 tick events (1313 bars, 434861 bar states) processed within 52260 ms (total time 52650 ms)

this is first attempt to make a trade with 10k equity
Author:  xmess7 [ Mon Aug 11, 2014 12:31 pm ]
Post subject:  Coin-Flip EA v2.0

Check that 'Allowed Trading' is active. I've seen this error before and it's because I forget to set the 'Allowed Trading' check boxes.

J
acs » Mon Aug 11, 2014 2:55 am wrote:got error forward testing EAv26

Experts error log

10:54:43 CoinFlip EA V26R EURUSD,H1: initialized
11:00:00 CoinFlip EA V26R EURUSD,H1: trade operations not allowed by settings
11:00:00 CoinFlip EA V26R EURUSD,H1: OrderSend function error = 0

orders with the broker have to be sperate, they will not let you send order+SL+TP with one command
you send order first and then modify order, at least I think that is what the problem is here.

acs
Author:  acs [ Mon Aug 11, 2014 1:18 pm ]
Post subject:  Coin-Flip EA v2.0

Hi Jess
you were right :oops: forgot to make sure live trading was selected sorry
I guess my brain was not in gear.

acs
Author:  zhengzuodong [ Tue Aug 12, 2014 4:48 am ]
Post subject:  Coin-Flip EA v2.0

Hi, xmess7, thank you for your great work, salute you.
About trading hours (TradeCandle = 2) problems may need to be adjusted.
According to the original post:http://www.forexfactory.com/showthread. ... ost7614364
London opening: 9:00 (London time, GMT)
1st Candle 9: 00-10: 00 (We do not trade here, it's the breakout)
2st Candle 10: 00-11: 00 (At the beginning of the candle we close the trade of yesterday)
At the end of the candle we open the new trade.
Buy if the candle is bullish
Sell ​​if the candle is bearish
3th Candle 11: 00-12: 00 (Here we do nothing), in fact, it can be said that at the beginning of this candle, open transactions.
So:
EA program first 141-145 lines:

Code: Select all

   if (TimeHour (TimeCurrent ()) ==TimeHour (LOTinBroker) + TradeCandle && ExistOrderFlag) 
   {
      CloseOrdersByMagicNumber (MagicNumber); 
      ExistOrderFlag = 0; 
   } 
If LOTinBroker = 9, then close the transaction time (LOTinBroker + TradeCandle) at 11:00 (3rd candle started);

EA program 152 line:
  

Code: Select all

 if (TimeHour (TimeCurrent ()) == TimeHour (LOTinBroker) + (TradeCandle + 1))

Open orders And later conditions:
   LOTinBroker) + (TradeCandle + 1) = 12: 00, then open the transaction time is set to start in the 4th candle.

   These two issues inconsistent with the original post. If there is something wrong, please correct me.
Trade luck.
Author:  xmess7 [ Tue Aug 12, 2014 8:29 am ]
Post subject:  Coin-Flip EA v2.0

Yep, I am right their with you brother! It took a little bit of thought to understand the original poster's idea. The main reason for adding the input TradeCandle was so users can set their own trading time, for example Spyderman is using the Asian session. So if u set the TradeCandle to 1 then the EA will perform according to the original post.

With TradeCandle =1 then the following will close an Order when when LOTinBroker+TradeCandle (9+1) or 10th hour is reached.

Code: Select all

 
if (TimeHour (TimeCurrent ()) ==TimeHour (LOTinBroker) + TradeCandle && ExistOrderFlag) {
      CloseOrdersByMagicNumber (MagicNumber); 
      ExistOrderFlag = 0; 
   } 
So then on the following, the code looks to see if LOTBroker+TradeCandle+1 (9+1+1), the 11th hour, is reached. Once the 11th hour starts the EA will try to open a trade.

Code: Select all

 
if (TimeHour (TimeCurrent ()) == TimeHour (LOTinBroker) + (TradeCandle + 1))


So it's just a matter of setting TradeCandle to 1. I could of set the TradeCandle to 1 as a default but thought that the trader would change it, so I left it alone. On the next version (2.7) I'll do that.

All comments and questions are more than welcomed. IF you still need more info let me know.
The next things to tackle are the following:
1. Detect when Lotsize is to large and adjust it until there is enuf margin to trade
2. Add a True/False flag that will allow the trader to only use HardSL and HardTP, no ATR nor yesterdays low.
3. Detect when there is an invalid SL and/or TP and fix it right away before modifying the order.

Life is fun and busy on this side of the screen.... so I'll take a look at these during the weekend.
(hmmm Today someone offered to help, lets see if we can get it going... )

Peace

zhengzuodong » Mon Aug 11, 2014 8:48 pm wrote:Hi, xmess7, thank you for your great work, salute you.
About trading hours (TradeCandle = 2) problems may need to be adjusted.
According to the original post:http://www.forexfactory.com/showthread. ... ost7614364
London opening: 9:00 (London time, GMT)
1st Candle 9: 00-10: 00 (We do not trade here, it's the breakout)
2st Candle 10: 00-11: 00 (At the beginning of the candle we close the trade of yesterday)
At the end of the candle we open the new trade.
Buy if the candle is bullish
Sell ​​if the candle is bearish
3th Candle 11: 00-12: 00 (Here we do nothing), in fact, it can be said that at the beginning of this candle, open transactions.
So:
EA program first 141-145 lines:

Code: Select all

   if (TimeHour (TimeCurrent ()) ==TimeHour (LOTinBroker) + TradeCandle && ExistOrderFlag) 
   {
      CloseOrdersByMagicNumber (MagicNumber); 
      ExistOrderFlag = 0; 
   } 
If LOTinBroker = 9, then close the transaction time (LOTinBroker + TradeCandle) at 11:00 (3rd candle started);

EA program 152 line:
  

Code: Select all

 if (TimeHour (TimeCurrent ()) == TimeHour (LOTinBroker) + (TradeCandle + 1))

Open orders And later conditions:
   LOTinBroker) + (TradeCandle + 1) = 12: 00, then open the transaction time is set to start in the 4th candle.

   These two issues inconsistent with the original post. If there is something wrong, please correct me.
Trade luck.
Author:  zhengzuodong [ Tue Aug 12, 2014 3:01 pm ]
Post subject:  Coin-Flip EA v2.0

Yep, I am right their with you brother! It took a little bit of thought to understand the original poster's idea. The main reason for adding the input TradeCandle was so users can set their own trading time, for example Spyderman is using the Asian session. So if u set the TradeCandle to 1 then the EA will perform according to the original post.

With TradeCandle =1 then the following will close an Order when when LOTinBroker+TradeCandle (9+1) or 10th hour is reached.
Hi,Xmess7.
Your explanation is right, but I think setting of the variable should be a relative position (eg, the offset of the behind London session open candle)
In fact, I have the variable "TradeCandle" was renamed "TradeAfterOpenOffset", and still set it to 2. Means placed trade at the start of 2nd candle behind London (or other market) opened candle. Similarly, if you set it to 1, meaning that orders placed in 1st candle after the market open candle.
This is more consistent with the original post ideas, also more intuitive, and does not confuse.

Meanwhile, I will change the program as follows:

Code: Select all

if (TimeHour (TimeCurrent ()) ==TimeHour (LOTinBroker) + (TradeCandle-1) && ExistOrderFlag) {
      CloseOrdersByMagicNumber (MagicNumber);
      ExistOrderFlag = 0;
   }

Code: Select all

if (TimeHour (TimeCurrent ()) == TimeHour (LOTinBroker) + TradeCandle ))
Of course, you can not change, as long as you can remember where you are.

thanks all

trade happy
Author:  xmess7 [ Tue Aug 12, 2014 4:55 pm ]
Post subject:  Coin-Flip EA v2.0

zhengzuodong, from some of the testing, currently the EA will close a trade at the beginning of the TradeCandle (just as at the candle opens) and open a trade at the end of the TradeCandle (or right after it closes). This is what I saw and what I see on my forward testing. I called the variable TradeCandle cause in my thought that it was like, that was the Candle that the user wanted these things to happen.

So we could rename it to TradeCandleAfterMarketOpen. I understand what you are saying, it's just that it comes down to making this the simplest as possible.

We'll work on it...
zhengzuodong » Tue Aug 12, 2014 7:01 am wrote:
Yep, I am right their with you brother! It took a little bit of thought to understand the original poster's idea. The main reason for adding the input TradeCandle was so users can set their own trading time, for example Spyderman is using the Asian session. So if u set the TradeCandle to 1 then the EA will perform according to the original post.

With TradeCandle =1 then the following will close an Order when when LOTinBroker+TradeCandle (9+1) or 10th hour is reached.
Hi,Xmess7.
Your explanation is right, but I think setting of the variable should be a relative position (eg, the offset of the behind London session open candle)
In fact, I have the variable "TradeCandle" was renamed "TradeAfterOpenOffset", and still set it to 2. Means placed trade at the start of 2nd candle behind London (or other market) opened candle. Similarly, if you set it to 1, meaning that orders placed in 1st candle after the market open candle.
This is more consistent with the original post ideas, also more intuitive, and does not confuse.

Meanwhile, I will change the program as follows:

Code: Select all

if (TimeHour (TimeCurrent ()) ==TimeHour (LOTinBroker) + (TradeCandle-1) && ExistOrderFlag) {
      CloseOrdersByMagicNumber (MagicNumber);
      ExistOrderFlag = 0;
   }

Code: Select all

if (TimeHour (TimeCurrent ()) == TimeHour (LOTinBroker) + TradeCandle ))
Of course, you can not change, as long as you can remember where you are.

thanks all

trade happy
Author:  zhengzuodong [ Wed Aug 13, 2014 12:38 am ]
Post subject:  Coin-Flip EA v2.0

yes, we will work on it.
Author:  zhengzuodong [ Thu Aug 14, 2014 5:26 pm ]
Post subject:  Coin-Flip EA v2.0

Hello everyone.

According to the aforementioned problems, I made ​​some changes in the 2.6 version:
1 adds MinFreeMarginRatio parameters. Default setting is 500%, is used to control large Lots.
2 adds ProfitPercent parameters, when profit is equal to the balance * ProfitPercent, close orders.
3. Modify MagicNumber automatically adapt to eight pairs of major currency pairs, correspond as follows:
pairs [8] = {"AUDUSD", "EURUSD", "GBPUSD", "NZDUSD", "USDCAD", "USDCHF", "USDJPY", "EURJPY"};
magic [8] = {111, 222, 333, 444, 555, 666, 777, 888};
The rest of the currency pair is set to 999.
4. adds orders closing and opening time display, and were labeled as "C" and "O" in the candles chart.
5. Some other minor amendments.
6. Updated to version 2.61

Please test forward any suggestions and questions are welcome.
Trade Luck. :!!:

Attachment CoinFlip EA V261
CoinFlip EA V261.mq4
All times are UTC Page 10 of 19