Fratelli EA by Dragos and magft

Post Reply
garyfritz

Re: Fratelli EA by Dragos and magft

Post by garyfritz »

gaheitman wrote:As for closing the trades, I believe the strategy calls for closing trades when the signals reverse. Is that what happened?
Nope. The first trade entered at 22:00 and exited 2 bars later. Candles and MACD are still red, no arrows, should be far from the SL, then it exits somehow. Same for the second trade -- all still red.
Panamamike
Trader
Posts: 104
Joined: Tue Nov 15, 2011 11:45 pm

Re: Fratelli EA by Dragos and magft

Post by Panamamike »

I have set up a demo to trade the latest version. I have set the trading hours by GMT and my local time. I am in GMT-5. It is 7:32 pm here and it is taking trades.

I have tried both 6:58 ( for GMT time) and 1:58 ( for local time) as the starting time and either way it is taking trades currently when it should not be. Anyone else having issues with the start and end times?
magft
Trader
Posts: 195
Joined: Tue Nov 15, 2011 9:59 pm
Location: East Midlands, UK

Re: Fratelli EA by Dragos and magft

Post by magft »

Panamamike wrote:I have set up a demo to trade the latest version. I have set the trading hours by GMT and my local time. I am in GMT-5. It is 7:32 pm here and it is taking trades.

I have tried both 6:58 ( for GMT time) and 1:58 ( for local time) as the starting time and either way it is taking trades currently when it should not be. Anyone else having issues with the start and end times?
I hadn't been able to test the new trading times routine, obviously not correct for those not on GMT. I am working on next version thanks to George's help, i wont be releasing til i am sure i have fixed the issues i am meant to be fixing if that makes sense :roll:

Can you run this script and see if it says yes on expert tab, it prints out times entered as minutes and it current local time is in valid range it prints yes?

Someone asked if the new offline chart indy was better than Empty4 default one. I took a modified one that improved speed and added the code to allow EAs to run on offline chart, thanks to John in T101 Basket Trader.

I'm off to bed now, lets hope the market responds like today so we can all rake in the pips :mrgreen:

Mike
You do not have the required permissions to view the files attached to this post.
Panamamike
Trader
Posts: 104
Joined: Tue Nov 15, 2011 11:45 pm

Re: Fratelli EA by Dragos and magft

Post by Panamamike »

It printed start and end times in minutes. Not sure what the times were referrencing s they did not match my settings.
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: Fratelli EA by Dragos and magft

Post by gaheitman »

magft wrote: Can you run this script and see if it says yes on expert tab, it prints out times entered as minutes and it current local time is in valid range it prints yes?

Mike
Since we obviously need a third way to check the trading times.... :D

Attached is a script with an alternative way of checking the times. I have also included a short loop in the start that will verify trading times so you can test various begin/end scenarios. It evaluates whether you can trade for every 15 min bar in a day.

I'll be honest, I never really liked adding a day to one of the times to perform the inclusion test. Instead, I check and see if the end time is before the begin time and then change the evaluation to be a logical OR instead of an AND. For example, here's the normal case:

Code: Select all

//Check normal case for morning , 7:00-13:00
if (MorningBeg < MorningEnd && (Now >= MorningBeg && Now < MorningEnd))
   Morning = true;
and the case where the start time is after the end time

Code: Select all

//Check to see if MorningBeg to MorningEnd spans 00:00, e.g. 22:00 - 04:00
if (MorningEnd < MorningBeg && (Now >= MorningBeg || Now < MorningEnd))
   Morning = true;
Fortunately, we all think differently, but I find this easier to understand. I have no doubt that's more a sign of my own mental laziness than anything to do with the other approaches. :D

George
You do not have the required permissions to view the files attached to this post.
magft
Trader
Posts: 195
Joined: Tue Nov 15, 2011 9:59 pm
Location: East Midlands, UK

Re: Fratelli EA by Dragos and magft

Post by magft »

gaheitman wrote:
magft wrote: Can you run this script and see if it says yes on expert tab, it prints out times entered as minutes and it current local time is in valid range it prints yes?

Mike
Since we obviously need a third way to check the trading times.... :D

Attached is a script with an alternative way of checking the times. I have also included a short loop in the start that will verify trading times so you can test various begin/end scenarios. It evaluates whether you can trade for every 15 min bar in a day.

I'll be honest, I never really liked adding a day to one of the times to perform the inclusion test. Instead, I check and see if the end time is before the begin time and then change the evaluation to be a logical OR instead of an AND. For example, here's the normal case:

Code: Select all

//Check normal case for morning , 7:00-13:00
if (MorningBeg < MorningEnd && (Now >= MorningBeg && Now < MorningEnd))
   Morning = true;
and the case where the start time is after the end time

Code: Select all

//Check to see if MorningBeg to MorningEnd spans 00:00, e.g. 22:00 - 04:00
if (MorningEnd < MorningBeg && (Now >= MorningBeg || Now < MorningEnd))
   Morning = true;
Fortunately, we all think differently, but I find this easier to understand. I have no doubt that's more a sign of my own mental laziness than anything to do with the other approaches. :D

George
Once again, thanks George. I have added to the update v2.6 in post #1. It is very nicely written and very clear to understand, i have used your other comments in the new version. In the LFTO i have used High[2] and Close[2] as on inspection of trades taken today using High[1] it was too high ie we were on the candle after the signal candle so that is why i am trying the one before that. I think the issue is if the arrow is on the candle when all others signals match it should be High[1] but if arrow is further back in time it should be High[2]. This needs reviewing, though i have made 63pips this morning already :mrgreen:

Mike
DragosDanescu
Trader
Posts: 118
Joined: Wed Nov 16, 2011 5:18 pm
Location: Oradea, Western Romania

Re: Fratelli EA by Dragos and magft

Post by DragosDanescu »

Wow, excuse me not to follow this one, I was tried to code some Ea for another thread.
Well, in order to be able to adjust what's need adjusting and correcting, I'm using my own version, with default trading time settings, that seems to work ok, all correlated to LocalTime() (computer time).

I use that because part of the Mike's code is too complex for my limited understanding, cheers Mike, but I need to learn a bit more to be able to modify it.

Mike and George, I noticed in ST that this piece of code here in int start section, prevents EA to open orders on the current candle.Maybe this is the cause market orders gets delayed, at least, after removing it, in ST EA is taking buys/sells on the current candle.

Code: Select all

   //Trading
   if (OldBars != Bars)
   {
      OldBars = Bars;
      
      if (TicketNo == -1 && !StopTrading)
      {   
         LookForTradingOpportunities();
      }//if (TicketNo == -1)
   }//if (OldBars != Bars)
Instead, I moved "LookForTradingOpportunities();" in the 1st check if TotalOrders == 0.

Cheers, Dragos
Image
magft
Trader
Posts: 195
Joined: Tue Nov 15, 2011 9:59 pm
Location: East Midlands, UK

Re: Fratelli EA by Dragos and magft

Post by magft »

Yes the code is getting too complex, i have tried to streamline a bit but still difficult to edit unless familiar with Steve's code :lol:

Ok question for you guys, should the LastOrderTime, the check i use to make sure the Arrow has appeared after this, should it be the time the trade opens or the time the trade closes?

I am just modifying the code as i recompiled with the new time code and it opened a new trade as the LastOrderTime was 0! So now i have a function that checks for last trade and if the time (open/close) is greater than arrow time it updates LastOrderTime. I've added the function as a filter to stop trading if no arrow has appeared since open/close of last trade.

From Fratelli thread i think it should be close of trade but i'm not sure.
DragosDanescu
Trader
Posts: 118
Joined: Wed Nov 16, 2011 5:18 pm
Location: Oradea, Western Romania

Re: Fratelli EA by Dragos and magft

Post by DragosDanescu »

magft wrote:Yes the code is getting too complex, i have tried to streamline a bit but still difficult to edit unless familiar with Steve's code :lol:

Ok question for you guys, should the LastOrderTime, the check i use to make sure the Arrow has appeared after this, should it be the time the trade opens or the time the trade closes?

I am just modifying the code as i recompiled with the new time code and it opened a new trade as the LastOrderTime was 0! So now i have a function that checks for last trade and if the time (open/close) is greater than arrow time it updates LastOrderTime. I've added the function as a filter to stop trading if no arrow has appeared since open/close of last trade.

From Fratelli thread i think it should be close of trade but i'm not sure.
I think close it also ok, as it's more safe compared to open(I mean the difference between close and arrow time is certain). Hmm...as a second thought, what if the order close happens after a new arrow? No, I would still use open. Even if you set arrow time one minute back, just to be sure it's different than order open time.
Image
User avatar
dynel14
Trader
Posts: 37
Joined: Wed Nov 16, 2011 1:38 am
Location: Cologne/Germany

Re: Fratelli EA by Dragos and magft

Post by dynel14 »

hi magft,

EA opened a buy just right now on EJ. But Arrow is down!?
You do not have the required permissions to view the files attached to this post.
Post Reply

Return to “Automated trading systems”