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

Macd Stochastic Fractal MA5/25 Daily Marylin
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=1448
Page 68 of 141
Author:  Radar [ Sat Jul 06, 2013 4:00 pm ]
Post subject:  Re: Macd Stochastic Fractal MA5/25 Daily Marylin

Hey Dudest,
dudest wrote:
Yeah, change the 1440's to 15, the 240's to 5, and the W1's to 1440...
I'm wondering whether the W1's should be changed to 30 (instead of 1440) [ since M30 is the higher TF to M15, as W1 is to D1... ]

Mapping:
W1 --> M30 [30]
D1 --> M15 [15]
H4 --> M5 [5]
I replaced the W1 with 1440 in the EA 'cos I was in a mad rush to set it up before going to work, and figured that 30 was too short... Thinking of relative time, maybe the hourly is a closer bet, (W1 being 5 * D1)... I don't know which would be best though, really.

Thanks for the parameter explanation file :) Makes it easier to play in Empty4's slacktester ;) Thanks also to Phil for the corrections :)
niepce wrote: You might shorten the timers as well
DeltaTimeLiveTrades=86400; 24H min between two live trades.
DeltaTimeHistoTrades=14400; 4H min between last closed trade and the new one.
Thanks for that one too, Niepce :)

I was looking through the code, and came across this...

Code: Select all

			   if(UseTakeProfitOn3MACD==true)
			   {
			    if(GetProfitPair(strSymbol,nMagic,OrderTicket())>0)
			     if(TimeElapsedSinceLastHistoSell(strSymbol, MagicNumber,OrderTicket())>=86400)
			      if(AllowedSpread(strSymbol)==true)
Should 86400 be changed to DeltaTimeHistoTrades (or DeltaTimeLiveTrades) so that we can adjust it when we go to lower timeframes? I'm thinking it should be DTHisto, but the current value is the same as DTLive.

The same value is used when checking TimeElapsedSinceLastHistoBuys, too.

Well, it's back to the slacktester for me ;)

Have fun!

Radar =8^)
Author:  niepce [ Sat Jul 06, 2013 5:29 pm ]
Post subject:  Re: Macd Stochastic Fractal MA5/25 Daily Marylin

Damn, 86400 should be changed indeed
Author:  Radar [ Sat Jul 06, 2013 6:22 pm ]
Post subject:  Re: Macd Stochastic Fractal MA5/25 Daily Marylin

niepce wrote:Damn, 86400 should be changed indeed
To? ;)
Author:  phil_trade [ Sat Jul 06, 2013 6:40 pm ]
Post subject:  Re: Macd Stochastic Fractal MA5/25 Daily Marylin

Radar wrote:
niepce wrote:Damn, 86400 should be changed indeed
To? ;)
Hi Radar

I think it's a big bug
if(UseTakeProfitOn3MACD==true)
{
if(GetProfitPair(strSymbol,nMagic,OrderTicket())>0)
if(TimeElapsedSinceLastHistoSell(strSymbol, MagicNumber,OrderTicket())>=86400)
No need to control "TimeElapsedSinceLastHistoSell" or "TimeElapsedSinceLastHistoBuy" in this "UseTakeProfitOn3MACD" routine ???

We need to control LastTrade to open a new trade, not to close it ?

Niepce should have a look
Author:  Radar [ Sat Jul 06, 2013 7:10 pm ]
Post subject:  Re: Macd Stochastic Fractal MA5/25 Daily Marylin

Hey Phil,
phil_trade wrote:
Radar wrote:
niepce wrote:Damn, 86400 should be changed indeed
To? ;)
Hi Radar

I think it's a big bug
if(UseTakeProfitOn3MACD==true)
{
if(GetProfitPair(strSymbol,nMagic,OrderTicket())>0)
if(TimeElapsedSinceLastHistoSell(strSymbol, MagicNumber,OrderTicket())>=86400)
No need to control "TimeElapsedSinceLastHistoSell" or "TimeElapsedSinceLastHistoBuy" in this "UseTakeProfitOn3MACD" routine ???

We need to control LastTrade to open a new trade, not to close it ?

Niepce should have a look
I think it's a test to make sure it doesn't look at bars previous to the opening of that trade...

I just checked the code... The TimeElapsed routine gets OrderOpenTime, which returns a value based in seconds, then subtracts that from current time... If that value is less than 86400, then 3MACD would end up using bars previous to the open bar... Not too good if you get 2 downward bars, then open a buy.

Have fun!

Radar =8^)
Author:  niepce [ Sat Jul 06, 2013 8:15 pm ]
Post subject:  Re: Macd Stochastic Fractal MA5/25 Daily Marylin

It's a bug that is affecting the take profit logic. It delays it, or even makes you miss the take profit at some point.
I am having a look into that this week end.
Author:  niepce [ Sat Jul 06, 2013 9:48 pm ]
Post subject:  Re: Macd Stochastic Fractal MA5/25 Daily Marylin

phil_trade wrote: No need to control "TimeElapsedSinceLastHistoSell" or "TimeElapsedSinceLastHistoBuy" in this "UseTakeProfitOn3MACD" routine ???
We need to control LastTrade to open a new trade, not to close it ?
Niepce should have a look
Just crawled through old PM's to find why there's this thing.
Here a crop of Windev code.

I've highlighted it :
if (OrderType = tp_buy) and (PaireMACD_D1Main[j,1] < PaireMACD_D1Main[j,2]) and (PaireMACD_D1Main[j,2] < PaireMACD_D1Main[j,3])and
(PaireMACD_D1Main[j,3] - PaireMACD_D1Main[j,1] >= MACD_DeltaPipsInterMacdToClose[j]*Point) then
begin
if (GetProfitDevise(PaireDevise[j],OrderTicket) < 0) and (MonBid < ReturnLowOpenPrice(PaireDevise[j],OrderTicket)) then
begin
Lprint(PaireDevise[j]+' -> Solde BUY sur Perte et 3 MACD baissiers-> Delta MACD 3-1 = '+MaValeurToStr(PaireMACD_D1Main[j,3] - PaireMACD_D1Main[j,1]/Point,Digits) );
FermeTradeDevise(PaireDevise[j],tp_buy,0,999999);
exit;
end;

if (UseTakeProfitOn3MACD[j]=true) then
begin
MonNbHourHistoBUY := GetHourBetweenLastHISTOtrade(PaireDevise[j],tp_BUY,OrderTicket);
if (GetProfitDevise(PaireDevise[j],OrderTicket) > 0) and (MonNbHourHistoSELL > 24) then
begin
Lprint(PaireDevise[j]+' -> Prise Profit Partiel Buy sur 3 MACD haussiers ' );

if OrderLots <= 0.10 then
begin
Lprint(PaireDevise[j]+' -> Prise Profit Partiel Buy sur 3 MACD haussiers ' ) ;
CloseOrder(OrderTicket)
end
else
begin
Lprint(PaireDevise[j]+' -> Prise Profit Partiel Buy sur 3 MACD haussiers ' ) ;
CloseOrderPArtial(OrderTicket,0.10)
end;

exit;
end;
end;

end;

So, do we scratch this ?
Author:  phil_trade [ Sun Jul 07, 2013 7:07 am ]
Post subject:  Re: Macd Stochastic Fractal MA5/25 Daily Marylin

niepce wrote:
phil_trade wrote: No need to control "TimeElapsedSinceLastHistoSell" or "TimeElapsedSinceLastHistoBuy" in this "UseTakeProfitOn3MACD" routine ???
We need to control LastTrade to open a new trade, not to close it ?
Niepce should have a look
Just crawled through old PM's to find why there's this thing.
Here a crop of Windev code.

I've highlighted it :

So, do we scratch this ?
Hi Niepce

I also have to search what is it for as I don't remember :oops: That's FT code, not Windev, and I don"t use this module in Windev. I suppose it was for security purpose, to avoid Open/Close.
So Radar, I don"t know what to do with this in lower TimeFrame :lol:

Philippe
Author:  Radar [ Sun Jul 07, 2013 9:06 am ]
Post subject:  Re: Macd Stochastic Fractal MA5/25 Daily Marylin

Hey Guys,

As it is, it's testing to see if a trade is at least 1 bar old... I think it should test to see if the trade is at least 3 bars old before closing, on both winners and losers, to ensure that when opening a trade on a reversal bar, 3MACD doesn't close the trade if that reversal bar is shorter than the previous 2 bars.

So, would the following ensure that that happens?

Code: Select all

   if(GetProfitPair(Symbol(),nMagic,OrderTicket())<0)
   if(TimeElapsedSinceLastOpenTrade(strSymbol, MagicNumber,OrderTicket())>=(3 * DeltaTimeLiveTrades))  
   if(Bid>ReturnHighOpenPrice(strSymbol,nMagic,OrderTicket()))
   if(AllowedSpread(Symbol())==true)
	     {
		Alert("CloseTradeIfMACD :Attempting to close ",strSymbol);
		Print("CloseTradeIfMACD :Attempting to close ",strSymbol);
		if(OrderClose(OrderTicket(),OrderLots(),Ask,slippage,Red))
		{
		 Alert("CloseTradeIfMACD :Close ",strSymbol," Succeeded !");
		 Print("CloseTradeIfMACD :Close ",strSymbol," Succeeded !");
		}
		else
		{
		 Alert("CloseTradeIfMACD :Close ",strSymbol," Failed !");
		 Print("CloseTradeIfMACD :Close ",strSymbol," Failed !");
		}
		}
			   
		 if(UseTakeProfitOn3MACD==true)
		{
		    if(GetProfitPair(strSymbol,nMagic,OrderTicket())>0)
		     if(TimeElapsedSinceLastOpenTrade(strSymbol, MagicNumber,OrderTicket())>=(3 * DeltaTimeLiveTrades))
		 if(AllowedSpread(strSymbol)==true)
		 if(OrderLots()<=0.10)
...
You'll see that I've changed the test from TimeElapsedSinceLastHistoSell to TimeElapsedSinceLastOpenTrade... Does that look like it will do the trick?

Have fun,

Radar =8^)

edit... I tried the above code, but it won't compile... TimeElapsedSinceLastOpenTrade doesn't take the ticket number as a parameter... Will have to create TimeElapsedSinceLastOpenBuy and TimeElapsedSinceLastOpenSell, and see if that works.
Author:  Radar [ Sun Jul 07, 2013 10:23 am ]
Post subject:  Re: Macd Stochastic Fractal MA5/25 Daily Marylin

Ok, so I created TimeElapsedSinceLastOpenBuy and TimeElapsedSinceLastOpenSell, but now TimeElapsedSinceLastHistoBuy and TimeElapsedSinceLastHistoSell aren't being used at all, so I've commented them out...

Testing now...
All times are UTC Page 68 of 141