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 5 of 141
Author:  phil_trade [ Thu Feb 14, 2013 6:19 pm ]
Post subject:  Re: MACD STOCHASTIC FRACTAL MA5/25 DAILY EA

Hi All

Last code adaptation to fit more pairs : New one is AUUSD. This one go quicly to Stoch D1 OBOS. So I have added a module to add trade if
- Stoch D1 OBOS zone
- but STOCH H4 confirm trade ( for Buy Stoch H4 UP and < param level for SELL Stoch Down and > param level )

Modification of module : Close on Friday : Take the best trade for partial close (not the first one)

Code: Select all

//Close on Friday en prenant le trade le plus gagnant
    if MACD_UseCloseFriday[j] = true then
    begin
         if (DayOfTheWeek(TimeCurrent)= 5) and (HourOf(TimeCurrent)>= 21) and (MACD_FlagCloseFriday[j]=0) and
         ( ((OrderOpenPrice = ReturnLowOpenPrice(PaireDevise[j],OrderTicket)) and (OrderType = tp_buy)) or
         ((OrderOpenPrice = ReturnHighOpenPrice(PaireDevise[j],OrderTicket)) and (OrderType = tp_sell)) ) then
         begin
           MACD_FlagCloseFriday[j] := 1;
           if (OrderProfit>0) then
           begin
                   if OrderLots <= 0.10 then
                   begin
                      Lprint(PaireDevise[j]+' -> Close Finale sur Vendredi 21H ' ) ;
                      CloseOrder(OrderTicket)
                   end
                   else
                   begin
                      Lprint(PaireDevise[j]+' -> Close Partielle sur Vendredi 21H ' ) ;
                      CloseOrderPArtial(OrderTicket,0.10)
                   end;
           exit;
           end;
         end;

Modification of Module Close on 3 MACD : add a level mini delta pips between MACD Main 1 and 3

Code: Select all

// Ferme trade si Perte sur Devise et 3 MACD baisse pour Achat et inverst pour Vente
    if (OrderType = tp_sell) and (PaireMACD_D1Main[j,1] > PaireMACD_D1Main[j,2]) and (PaireMACD_D1Main[j,2] > PaireMACD_D1Main[j,3]) and
    (PaireMACD_D1Main[j,1] - PaireMACD_D1Main[j,3] >= MACD_DeltaPipsInterMacdToClose[j]*Point) then
    begin
      if (GetProfitDevise(PaireDevise[j],OrderTicket) < 0) and (MonBid > ReturnHighOpenPrice(PaireDevise[j],OrderTicket)) then
      begin
        Lprint(PaireDevise[j]+' -> Solde Sell sur Perte et 3 MACD haussiers -> Delta MACD 1-3 = '+MaValeurToStr(PaireMACD_D1Main[j,1] - PaireMACD_D1Main[j,3]/Point,Digits) );
        FermeTradeDevise(PaireDevise[j],tp_sell,0,999999);
        exit;
      end;

      if (UseTakeProfitOn3MACD[j]=true) then
      begin

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

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

    end;

    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;

Take Trade Buy/Sell

1 - added for pairs like AUDUSD : filter with STOCH H4
2 - added filter for BUY on Stoch SLOW 1 < Stoch Slow 2 and for SELL on Stoch SLOW 1 > Stoch Slow 2
3 - added Minimum Level for MACD Main to take trade -> avoid range zone

BUY

Code: Select all

                   //Buy
                   if ( NbTradeBuy < MACD_NbTradeMax[kk]) and (NbTradeSell = 0) and
                      ( PaireMACD_D1Main[kk,1] > PaireMACD_D1Main[kk,2]) and ( PaireMACD_D1Main[kk,2] > PaireMACD_D1Main[kk,3]) and
                      ( (( _STOD1SLOW[kk,1] <= MACD_StochLevelToTrade[kk]) and ( _STOD1FAST[kk,1] >  _STOD1SLOW[kk,1]) and ( _STOD1FAST[kk,1] >  _STOD1FAST[kk,2]) and
                      (( _STOD1SLOW[kk,1] >  _STOD1SLOW[kk,2]) or (UseStochD1slowToFilterTrade[kk]=false)) ) or
                      ( (UseStochH4ToTakeTrade[kk]=true) and (_STOD1SLOW[kk,1] > MACD_StochLevelToTrade[kk]) and
                      (_STOH4FAST[kk,1] < MACD_StochH4LevelMax[kk]) and ( _STOH4FAST[kk,1] > _STOH4FAST[kk,2]) and ( _STOH4FAST[kk,1] > _STOH4Slow[kk,1]) ) ) and
                      ( PaireMA5[kk,1] > PaireMA5[kk,2]) and ( PaireMA5[kk,2] > PaireMA5[kk,3]) and ( PaireMA25[kk,2] - PaireMA25[kk,1] < MACD_DeltaPipsMA25[kk]*Point ) and
                      ((MonNbHour > MACD_HOURDELAY[kk] ) or (MonNbHour=9999)) and ((MonNbHourHistoBUY > MACD_HOURDELAY2[kk] ) or (MonNbHourHistoBUY=9999)) and
                      ( (PaireMACD_D1Main[kk,1] >= MACD_LevelMinTotrade[kk]) or (PaireMACD_D1Main[kk,3] <= -MACD_LevelMinTotrade[kk]) ) then
                   begin
SELL :

Code: Select all

                   // Sell
                   if ( NbTradeSell < MACD_NbTradeMax[kk]) and (NbTradeBuy = 0) and
                      ( PaireMACD_D1Main[kk,1] < PaireMACD_D1Main[kk,2]) and ( PaireMACD_D1Main[kk,2] < PaireMACD_D1Main[kk,3]) and
                      ( (( _STOD1SLOW[kk,1] >= 100-MACD_StochLevelToTrade[kk]) and ( _STOD1FAST[kk,1] <  _STOD1SLOW[kk,1]) and ( _STOD1FAST[kk,1] <  _STOD1FAST[kk,2]) and
                      (( _STOD1SLOW[kk,1] < _STOD1SLOW[kk,2]) or (UseStochD1slowToFilterTrade[kk]=false)) ) or
                      ( (UseStochH4ToTakeTrade[kk]=true) and (_STOD1SLOW[kk,1] < 100-MACD_StochLevelToTrade[kk]) and
                      (_STOH4FAST[kk,1] > 100-MACD_StochH4LevelMax[kk]) and ( _STOH4FAST[kk,1] < _STOH4FAST[kk,2]) and ( _STOH4FAST[kk,1] < _STOH4Slow[kk,1]) ) ) and
                      ( PaireMA5[kk,1] < PaireMA5[kk,2]) and ( PaireMA5[kk,2] < PaireMA5[kk,3]) and ( PaireMA25[kk,1] - PaireMA25[kk,2] < MACD_DeltaPipsMA25[kk]*Point ) and
                      ((MonNbHour > MACD_HOURDELAY[kk] ) or (MonNbHour=9999)) and ((MonNbHourHistoBUY > MACD_HOURDELAY2[kk] ) or (MonNbHourHistoBUY=9999)) and
                      ( (PaireMACD_D1Main[kk,3] >= MACD_LevelMinTotrade[kk]) or (PaireMACD_D1Main[kk,1] <= -MACD_LevelMinTotrade[kk]) ) then
                   begin
Author:  phil_trade [ Thu Feb 14, 2013 6:22 pm ]
Post subject:  Re: MACD STOCHASTIC FRACTAL MA5/25 DAILY EA

MQl4 code is running in test :

first trade OK : Release will be soon uploaded.

As the equity curve seems amazing, we decide to name it : Marylin :lol:
Marylin Empty4 conversion code running.PNG
Author:  Zypip [ Fri Feb 15, 2013 9:00 am ]
Post subject:  Re: MACD STOCHASTIC FRACTAL MA5/25 DAILY EA

Bonjour Phil,

Really like the S/R detection filter. I had just one question on this. If I understood it right, you check whether pa falls within X points from the S/R zones calculated by the S/R indi. If it does it would validate your trade or not. Is the number of retest of the S/R zone embedded within the EA logic or do you consider that the other filters (MA + STOCHS) will take care of these situations.

My point is that the "strength" of a S/R zone should decrease with the number of retest of that zone. I would usually not consider a S/R zone that has been tested more than once or twice.

Sorry if the answer to my question is obvious or can be found within the coding you have already posted. I don't have the skills to find my way through coding jargon yet.

Cheers, Ben
Author:  niepce [ Fri Feb 15, 2013 9:03 am ]
Post subject:  Re: MACD STOCHASTIC FRACTAL MA5/25 DAILY EA

Some additionnal teasing

Image
Author:  phil_trade [ Fri Feb 15, 2013 9:38 am ]
Post subject:  Re: MACD STOCHASTIC FRACTAL MA5/25 DAILY EA

Zypip wrote:Bonjour Phil,

Really like the S/R detection filter. I had just one question on this. If I understood it right, you check whether pa falls within X points from the S/R zones calculated by the S/R indi. If it does it would validate your trade or not. Is the number of retest of the S/R zone embedded within the EA logic or do you consider that the other filters (MA + STOCHS) will take care of these situations.

My point is that the "strength" of a S/R zone should decrease with the number of retest of that zone. I would usually not consider a S/R zone that has been tested more than once or twice.

Sorry if the answer to my question is obvious or can be found within the coding you have already posted. I don't have the skills to find my way through coding jargon yet.

Cheers, Ben
Hi Ben

S/R are used to avoid trade if Bid too near S/R zone (param pips) and only if strengh zone >= 4

I again have to refine these parameters.
My point is that the "strength" of a S/R zone should decrease with the number of retest of that zone. I would usually not consider a S/R zone that has been tested more than once or twice.
Could you developp this please ? S/R indi increase strengh with the number of hits, so I avoid trade too near. If I understand you well, you consider the opposite ?

cheers

Philippe
Author:  phil_trade [ Fri Feb 15, 2013 9:40 am ]
Post subject:  Re: MACD STOCHASTIC FRACTAL MA5/25 DAILY EA

niepce wrote:Some additionnal teasing

Image
To all :

Niepce is doing test with all pairs, but only pairs that have passed FT test would be used !
Author:  Zypip [ Fri Feb 15, 2013 10:03 am ]
Post subject:  Re: MACD STOCHASTIC FRACTAL MA5/25 DAILY EA

phil_trade wrote:
Zypip wrote:Bonjour Phil,

Really like the S/R detection filter. I had just one question on this. If I understood it right, you check whether pa falls within X points from the S/R zones calculated by the S/R indi. If it does it would validate your trade or not. Is the number of retest of the S/R zone embedded within the EA logic or do you consider that the other filters (MA + STOCHS) will take care of these situations.

My point is that the "strength" of a S/R zone should decrease with the number of retest of that zone. I would usually not consider a S/R zone that has been tested more than once or twice.

Sorry if the answer to my question is obvious or can be found within the coding you have already posted. I don't have the skills to find my way through coding jargon yet.

Cheers, Ben
Hi Ben

S/R are used to avoid trade if Bid too near S/R zone (param pips) and only if strengh zone >= 4

I again have to refine these parameters.
My point is that the "strength" of a S/R zone should decrease with the number of retest of that zone. I would usually not consider a S/R zone that has been tested more than once or twice.
Could you developp this please ? S/R indi increase strengh with the number of hits, so I avoid trade too near. If I understand you well, you consider the opposite ?

cheers

Philippe
Thanks for your reply Philippe. I have PMed you some stuff on SUP/DEM.

Ben
Author:  spotdespot [ Fri Feb 15, 2013 10:18 am ]
Post subject:  Re: MACD STOCHASTIC FRACTAL MA5/25 DAILY EA

Watching with interest guys - looks very interesting and I love the name :-)

I have to say that there are conflicting theories re supply/demand and retests. Most theories say that supply/demand create support/resistance areas because when price has moved from that key area in the past orders accumulate there expecting a retest. Even when considerable time has passed the order flows still remain.

Then it gets less clear - some will say that on the retest the supply or demand (effectively the waiting orders) will kick in creating S/R and once seen as confirmed S/R more orders are placed at that area thereby strengthening S/R and repeated retests reinforce that.

Others will say that it starts that way but each successive retest will attract fewer orders and therefore it becomes weaker.

Bottom line imo is that if it works (and it certainly seems to be working) then don't mess with it ("if it ain't broke don't fix it") :lol:

Cheers,
Dave.
Author:  niepce [ Fri Feb 15, 2013 1:41 pm ]
Post subject:  Re: MACD STOCHASTIC FRACTAL MA5/25 DAILY EA

spotdespot wrote: Others will say that it starts that way but each successive retest will attract fewer orders and therefore it becomes weaker.
..and it gets worse when the zone is "almost" restested, i.e. price bouncing near it, but still not penetrate it. Some says the order flow's getting weaker still your zone hasn't been really retested by price touching it. So evaluating the weakness of a zone is an art by itself.

That's all words.

Look at this GBPCAD resistance :

Image

Tested 34 times :o . Getting any weaker ? :?
Author:  spotdespot [ Fri Feb 15, 2013 4:39 pm ]
Post subject:  Re: MACD STOCHASTIC FRACTAL MA5/25 DAILY EA

niepce wrote:
Tested 34 times :o . Getting any weaker ? :?
I agree with you - in my experience it is best to assume resistance will hold until it doesn't. ;)

The point I was really making is that what you have done works so no need to try to "fix" something that works.

Have a good w/e.

Cheers,
Dave.
All times are UTC Page 5 of 141