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

Nanningbob 10.2 auto-trading EA
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=552
Page 25 of 54
Author:  astral77 [ Sun May 27, 2012 1:23 am ]
Post subject:  Re: 10.2; the auto-trading EA is born.

garyfritz wrote:...Thanks for the clarification, Astral!
My pleasure. The beauty of it is that you do not even need to use a magic number. You can just choose the setting "manage all trades". The only problem I have had with it is that when choosing hide tp / sl and using jumping or trailing stops it closes the trades. Mind you I think the problem may be with me choosing conflicting settings!!! Well it is Saturday night and time to hit the single malt again.
Enjoy your weekend.
Kind regards
Author:  phil_trade [ Sun May 27, 2012 1:17 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

SteveHopwood wrote:
phil_trade wrote:So there is a pingpong with AdjustStopLoss() which remove SL to the line value :geek:
Yes, I know. Couldn't solve it for me, could you? You clearly understand coding to a level far beyond me. Once upon a time this blasted routine worked, then I accepted a change which broke it and it has remained broken ever since whatever I have tried to do. Never again, ever, will I fix something that aint broke, however much I respect the individual who offers the 'enhancement'.

I am very close to removing the bloody routine altogether and telling people to use mptm. It is what mptm is intended for, after all.

We are talking serious frustration and irritation here.

:D
Hi Steve

I think you can yell 'Yeppeee" as NB 10.2 V1u is working well for me with stealth.
I set Hidden pips to 40
I try on EURUSD D1/H4 Trend Trade 2011.01.24 8:00 buy 1.36050 SL 1.31327
I manually move the SL line to 1.35194 and when Bid cross 1.35194 the trade was closed by LookForTradeClosure() module !

So "Yeeeepppeeeee" :lol:

Philippe
Author:  SteveHopwood [ Sun May 27, 2012 1:27 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

phil_trade wrote:
SteveHopwood wrote:
phil_trade wrote:So there is a pingpong with AdjustStopLoss() which remove SL to the line value :geek:
Yes, I know. Couldn't solve it for me, could you? You clearly understand coding to a level far beyond me. Once upon a time this blasted routine worked, then I accepted a change which broke it and it has remained broken ever since whatever I have tried to do. Never again, ever, will I fix something that aint broke, however much I respect the individual who offers the 'enhancement'.

I am very close to removing the bloody routine altogether and telling people to use mptm. It is what mptm is intended for, after all.

We are talking serious frustration and irritation here.

:D
Hi Steve

I think you can yell 'Yeppeee" as NB 10.2 V1u is working well for me with stealth.
I set Hidden pips to 40
I try on EURUSD D1/H4 Trend Trade 2011.01.24 8:00 buy 1.36050 SL 1.31327
I manually move the SL line to 1.35194 and when Bid cross 1.35194 the trade was closed by LookForTradeClosure() module !

So "Yeeeepppeeeee" :lol:

Philippe
It is the jumping stop with Stealth that causes the problem, with the error 1 messages it generates. It is trying to modify the stoploss with a value that is already the stoploss, and I cannot work out why.

:D
Author:  phil_trade [ Sun May 27, 2012 2:04 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

Hi Steve

I think you can yell 'Yeppeee" as NB 10.2 V1u is working well for me with stealth.
I set Hidden pips to 40
I try on EURUSD D1/H4 Trend Trade 2011.01.24 8:00 buy 1.36050 SL 1.31327
I manually move the SL line to 1.35194 and when Bid cross 1.35194 the trade was closed by LookForTradeClosure() module !

So "Yeeeepppeeeee" :lol:

Philippe[/quote]
It is the jumping stop with Stealth that causes the problem, with the error 1 messages it generates. It is trying to modify the stoploss with a value that is already the stoploss, and I cannot work out why.

:D[/quote]

Ok. Could you tell me an example : Pairs and date that I can reproduce the bug please
Author:  phil_trade [ Sun May 27, 2012 3:01 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

Philippe[/quote]
It is the jumping stop with Stealth that causes the problem, with the error 1 messages it generates. It is trying to modify the stoploss with a value that is already the stoploss, and I cannot work out why.

:D[/quote]

Steve, I hope this version is OK. I have seen a jumping SL OK with HiddenPip = 50

Code: Select all

//Philippe's code version II for Stealth .
void JumpingStopLoss() 
{
   // Jump sl by pips and at intervals chosen by user .
   //if (OrderProfit() < 0) return;//Nothing to do.
   
   //Use the sl line if this is drawn on the chart.
   string LineName = SlPrefix + DoubleToStr(OrderTicket(), 0);
   double sl = OrderStopLoss();
   double real_sl = 0;
   
   if (ObjectFind(LineName) > -1 || HiddenPips > 0)
   {
      sl = ObjectGet(LineName, OBJPROP_PRICE1);
            
   }//if (ObjectFind(LineName) > -1)
   
   //if (sl == 0) return;//No line, so nothing to do
   double NewStop;
   bool modify=false;
   bool result;
   
   
    if (OrderType()==OP_BUY)
    {

       if (sl == 0) real_sl = OrderStopLoss();
       else real_sl = NormalizeDouble(sl - (HiddenPips*Point),Digits);  

       if (real_sl < OrderOpenPrice() ) return;//Not at breakeven yet

       if (real_sl == 0) real_sl = OrderOpenPrice();                          //No hidden stop loss line
       if (Bid >=  real_sl + ((JumpingStopPips * 2) * Point) )
       {
          NewStop = NormalizeDouble(real_sl + (JumpingStopPips * Point), Digits);
          
          if (AddBEP) NewStop = NormalizeDouble(NewStop + (BreakEvenProfit*Point), Digits);
          
                    
          if (NewStop - real_sl > Point) modify = true;//George again. What a guy
       }// if (Bid>= sl + (JumpingStopPips*Point) && sl>= OrderOpenPrice())     
    }//if (OrderType()==OP_BUY)
       
       if (OrderType()==OP_SELL)
       {

       if (sl == 0) real_sl = OrderStopLoss();
       else real_sl = NormalizeDouble(sl + (HiddenPips*Point),Digits);  
              
          if (real_sl > OrderOpenPrice() ) return;//Not at breakeven yet

          if (real_sl== 0) real_sl = OrderOpenPrice();                           //No hidden stop loss line
          if (Bid <= real_sl - ((JumpingStopPips * 2) * Point) )
          {
             NewStop = NormalizeDouble(real_sl - (JumpingStopPips * Point), Digits);
             
             if (AddBEP) NewStop = NormalizeDouble(NewStop - (BreakEvenProfit*Point), Digits);
             
                          
             if (real_sl - NewStop > Point) modify = true;//George again. What a guy   
          }// close if (Bid>= sl + (JumpingStopPips*Point) && sl>= OrderOpenPrice())         
       }//if (OrderType()==OP_SELL)


             
   //Move 'hard' stop loss whether hidden or not. Don't want to risk losing a breakeven through disconnect.
   if (modify)
   {
      while (IsTradeContextBusy() ) Sleep(100);
      result = OrderModify(OrderTicket(), OrderOpenPrice(), NewStop, OrderTakeProfit(), OrderExpiration(), CLR_NONE);      
      if (!result) ReportError();
      else
      {      
      Print(Symbol()+" Jumping SL");
      
      if (OrderType()==OP_BUY)  ObjectMove(LineName, 0, Time[0], NormalizeDouble(NewStop + (HiddenPips*Point),Digits));
      if (OrderType()==OP_SELL) ObjectMove(LineName, 0, Time[0], NormalizeDouble(NewStop - (HiddenPips*Point),Digits));
      }
      if (PartCloseEnabled && OrderLots() > Preserve_Lots)// Only try to do this if the jump stop worked
      {
         bool PartCloseSuccess = PartCloseTradeFunction();
         //if (!PartCloseSuccess) SetAGlobalTicketVariable();
      }//if (PartCloseEnabled && OrderLots() > Preserve_Lots)
   }//if (modify)

} //End of JumpingStopLoss sub
I attach an modify EA so you can test it

cheers

Philippe
Author:  SteveHopwood [ Sun May 27, 2012 5:48 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

It is the jumping stop with Stealth that causes the problem, with the error 1 messages it generates. It is trying to modify the stoploss with a value that is already the stoploss, and I cannot work out why.

:D
Steve, I hope this version is OK. I have seen a jumping SL OK with HiddenPip = 50

I attach an modify EA so you can test it

cheers

Philippe
Hehe. You are so modest. As though anything you code might actually be wrong. :lol:

Version 1v is in post 1; it is the previous version plus Philippe's fix, so if you downloaded his then you do not need the update.

Coders, sometime this week, I shall replace the code in the shell functions with Philippe's code.

Thanks Philippe.

:D
Author:  phil_trade [ Sun May 27, 2012 5:59 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

:evil:
SteveHopwood wrote:
It is the jumping stop with Stealth that causes the problem, with the error 1 messages it generates. It is trying to modify the stoploss with a value that is already the stoploss, and I cannot work out why.

:D
Steve, I hope this version is OK. I have seen a jumping SL OK with HiddenPip = 50

I attach an modify EA so you can test it

cheers

Philippe
Hehe. You are so modest. As though anything you code might actually be wrong. :lol:

Version 1v is in post 1; it is the previous version plus Philippe's fix, so if you downloaded his then you do not need the update.

Coders, sometime this week, I shall replace the code in the shell functions with Philippe's code.

Thanks Philippe.

:D
you're welcome :shock:

Don't you forget to put extern HiddenPip parameter ? :evil:
Author:  SteveHopwood [ Sun May 27, 2012 6:07 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

phil_trade wrote:you're welcome :shock:

Don't you forget to put extern HiddenPip parameter ? :evil:
Oops. Can't remember everything, as I am constantly reminding piano pupils when the forget the latest rock-bottom basic. :lol:

The three of you who downloaded the previous V1v need to re-download if you want to use Stealth.

:D
Author:  garyfritz [ Mon May 28, 2012 2:04 am ]
Post subject:  Re: 10.2; the auto-trading EA is born.

I'm still learning the system. I'm finding Verb's codex to be very useful -- now I'm just trying to find where Verb found those things in NB's booklets. :D

I wanted a bit more visual representation of the info in Verb's codex, so I condensed all the entry conditions into a table. This way you can easily see how the various entry types differ, or scan down the columns to see "OK if the H4 TMA is this and the H1 TMA is that, what should I be doing?"

Not sure if this will actually be helpful, but I offer it here in case it helps somebody understand this stuff. Please let me know if you find any errors.

Here it is in the order Verb listed them in his codex:
InOrder.gif
Here it is sorted with long entries first, short entries second:
LSorder.gif
Author:  mobthehop [ Mon May 28, 2012 4:07 am ]
Post subject:  Re: 10.2; the auto-trading EA is born.

Gary, this is helpful but I would not necessarily distinguish the different trade tfs as the methodology / trade conditions are same on H1/H4 / D1....

Over at FF, Binyamin just posted the following flow chart, which, I believe, is quite similar to your table - see attached. I think the referenced "blue line" is the MA 5 shift 1 of NB10.2 templates

As such, the decision process to go long or short is detailed, but from what I recall, NB only enters either on break of or bounce at daily / weekly pivot lines combined with MA cross confirmation (there are different MA 5 shifts associated with his currency groups 1 - 5). I will however re-read the manual for the fifth time and the last 100 or so posts of NB.....

As we are talking about 24 different currencies and I am quite partial to the "ducks in the row concept", I would be very interested to develop a traffic light system of 4-5 conditions that need to be met, then place pending buy x pips over next S/R line for break condition AND a pending sell y pips below next S/R line (for bounce at S/R)

Does that make sense?

BTW, as one of the sharpest minds here, would you be able to help me understand pivots (as calculated in NB 10.2) vs Fibonacci based pivots based weekly open time (eg London open vs NY Open vs broker open) etc - I simply don't get it

Cheers

Mop
All times are UTC Page 25 of 54