Holy Graily Bob's Candle Power

EA's inspired by nanningbob's work here, especially those based on his 240 Moving Average trend detection filter.
Post Reply
gtactual
Posts: 6
Joined: Sun Mar 08, 2015 2:43 am

Holy Graily Bob's Candle Power

Post by gtactual »

This is what I got on a 3K GP demo. 0.10 lot size and 20 basket profit as in the original settings coded by Steve and then TJF's settings for 1b. I found the original version really fascinating, but I had to move on to 1b. Am now on 1e with the default settings except the lot sizes which I have kept at 0.1. Have it on a small live account at the moment. Actually using it to recover that account. Will report on that enterprise later.
You do not have the required permissions to view the files attached to this post.
pipcruiser
Trader
Posts: 134
Joined: Wed Nov 16, 2011 8:24 am

Holy Graily Bob's Candle Power

Post by pipcruiser »

Thanks Steve,

personally I close out all positions after a good run and also when ie.I have say 12 buy positions and market is moving down, I choose the safe way and clear the table/re-shuffle.

Maybe a

Max open buys: 10
Max open sells: 10

could come in handy. Not sure if it will change the overall performance, but trading live I choose the safe route always.

Thx and have a great weekend

PC
SteveHopwood » Fri Sep 29, 2017 1:17 am wrote:[quote="pipcruiser » Thu Sep 28, 2017 9:56 pm"
I use the latest always and once in a while I close out manually all trades and start again.
Sing out if I can add anything helpful. It can always be subject to a true/false input and so cannot do any harm if the default is 'false'. Send me a pm if you do not want to experiment in public.

:xm:[/quote]
"Perfection is Achieved Not When There Is Nothing More to Add, But When There Is Nothing Left to Take Away"...
User avatar
dreambig2
Trader
Posts: 46
Joined: Sat Nov 19, 2016 12:54 am
Location: US

Holy Graily Bob's Candle Power

Post by dreambig2 »

My close Friday 6:00 didn't work out.

Set for "6" local time close but all trades closed at 00:00 local which is 8:00 broker time.... (did not use the 00:00 format, went with format already there maybe that was the problem).

Thought CP would look for ways to close by letting trades play out....trades were all closed simultaneously....pendings continue to be set on charts but trades did stop being placed.

Next Friday will try different combinations.
Of course could be something stupid on my part (still looking) wanted to get this posted so others would be aware when trying this feature.
Has anyone used yet?

Still lots of green :smile:
You do not have the required permissions to view the files attached to this post.
User avatar
eaymon
Trader
Posts: 187
Joined: Wed Dec 16, 2015 3:18 pm

Holy Graily Bob's Candle Power

Post by eaymon »

Hi all,

I am collecting set files to set up the EA showdown if you have one with ripe settings please share!

I currently have:
Candle Power SL.set
CANDLE POWER H4.set
(credit to those who helped to get it to this point)

are there any other set files for this EA that are high fliers?

Eaymon Latif
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Holy Graily Bob's Candle Power

Post by SteveHopwood »

dreambig2 » Fri Sep 29, 2017 11:07 am wrote:My close Friday 6:00 didn't work out.

Set for "6" local time close but all trades closed at 00:00 local which is 8:00 broker time.... (did not use the 00:00 format, went with format already there maybe that was the problem).

Thought CP would look for ways to close by letting trades play out....trades were all closed simultaneously....pendings continue to be set on charts but trades did stop being placed.

Next Friday will try different combinations.
Of course could be something stupid on my part (still looking) wanted to get this posted so others would be aware when trying this feature.
Has anyone used yet?

Still lots of green :smile:
This is a code bloop. Do a search for:
int hour = TimeHour(TimeCurrent() );

This should be:
int hour = TimeHour(TimeLocal() );

TimeCurrent() returns your broker's server time. I will leave you to guess what TimeLocal() returns. :lol:

-----------------------------

It looks as though DC might have solved the invalid stops error thingy in the break even and jumping stop functions. The experimental version has done no harm on my demo and so will become the released version in time for next week. In the meantime, fix the errors by copying these over the top of the existing functions:
Break even

Code: Select all

void BreakEvenStopLoss(int ticket) // Move stop loss to breakeven
{

   //Security check
   if (!BetterOrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES))
      return;
      
   double NewStop;
   bool result;
   bool modify=false;
   string LineName = SlPrefix + DoubleToStr(OrderTicket(), 0);
   double sl = ObjectGet(LineName, OBJPROP_PRICE1);
   double target = OrderOpenPrice();
   
   
   if (OrderType()==OP_BUY)
   {
      if (HiddenPips > 0) target-= (HiddenPips / factor);
      if (OrderStopLoss() >= target) return;
      if (Bid >= OrderOpenPrice () + (BreakEvenPips / factor) )          
      {
         //Calculate the new stop
         NewStop = OrderOpenPrice()+(BreakEvenProfit / factor);
         if (HiddenPips > 0)
         {
            if (ObjectFind(LineName) == -1)
            {
               ObjectCreate(LineName, OBJ_HLINE, 0, TimeCurrent(), 0);
               ObjectSet(LineName, OBJPROP_COLOR, Red);
               ObjectSet(LineName, OBJPROP_WIDTH, 1);
               ObjectSet(LineName, OBJPROP_STYLE, STYLE_DOT);
            }//if (ObjectFind(LineName == -1) )
         
            ObjectMove(LineName, 0, TimeCurrent(), NewStop);         
         }//if (HiddenPips > 0)
         modify = true;   
      }//if (Bid >= OrderOpenPrice () + (Point*BreakEvenPips) && 
   }//if (OrderType()==OP_BUY)               			         
    
   if (OrderType()==OP_SELL)
   {
     if (HiddenPips > 0) target+= (HiddenPips / factor);
      if (OrderStopLoss() <= target && OrderStopLoss() > 0) return;
     if (Ask <= OrderOpenPrice() - (BreakEvenPips / factor) ) 
     {
         //Calculate the new stop
         NewStop = OrderOpenPrice()-(BreakEvenProfit / factor);
         if (HiddenPips > 0)
         {
            if (ObjectFind(LineName) == -1)
            {
               ObjectCreate(LineName, OBJ_HLINE, 0, TimeCurrent(), 0);
               ObjectSet(LineName, OBJPROP_COLOR, Red);
               ObjectSet(LineName, OBJPROP_WIDTH, 1);
               ObjectSet(LineName, OBJPROP_STYLE, STYLE_DOT);
            }//if (ObjectFind(LineName == -1) )
         
            ObjectMove(LineName, 0, Time[0], NewStop);
         }//if (HiddenPips > 0)         
         modify = true;   
     }//if (Ask <= OrderOpenPrice() - (Point*BreakEvenPips) && (OrderStopLoss()>OrderOpenPrice()|| OrderStopLoss()==0))     
   }//if (OrderType()==OP_SELL)

   //Move 'hard' stop loss whether hidden or not. Don't want to risk losing a breakeven through disconnect.
   if (modify)
   {
      if (NewStop == OrderStopLoss() ) return;
      while (IsTradeContextBusy() ) Sleep(100);
      result = ModifyOrder(OrderTicket(), OrderOpenPrice(), NewStop, OrderTakeProfit(), OrderExpiration(), clrNONE, __FUNCTION__, slm);
      if (!result)
         Sleep(10000);//10 seconds before trying again
         
      while (IsTradeContextBusy() ) Sleep(100);
      if (PartCloseEnabled && OrderComment() == TradeComment) bool success = PartCloseOrder(OrderTicket() );
   }//if (modify)
   
} // End BreakevenStopLoss sub
Jumping stop:

Code: Select all

void JumpingStopLoss(int ticket) 
{
   // Jump sl by pips and at intervals chosen by user .

   //Security check
   if (!BetterOrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES))
      return;

   if (OrderProfit() < 0) return;//Nothing to do
   string LineName = SlPrefix + DoubleToStr(OrderTicket(), 0);
   double sl = ObjectGet(LineName, OBJPROP_PRICE1);
   if (CloseEnough(sl, 0) ) sl = OrderStopLoss();
   
   //if (CloseEnough(sl, 0) ) return;//No line, so nothing to do
   double NewStop;
   bool modify=false;
   bool result;
   
   RefreshRates();
   
    if (OrderType()==OP_BUY)
    {
       if (sl < OrderOpenPrice() ) return;//Not at breakeven yet
       // Increment sl by sl + JumpingStopPips.
       // This will happen when market price >= (sl + JumpingStopPips)
       //if (Bid>= sl + ((JumpingStopPips*2) / factor) )
       if (CloseEnough(sl, 0) ) sl = MathMax(OrderStopLoss(), OrderOpenPrice());
       if (Bid >=  sl + ((JumpingStopPips * 2) / factor) )//George{
       {
          NewStop = sl + (JumpingStopPips / factor);
          if (AddBEP) NewStop = NormalizeDouble(NewStop + (BreakEvenProfit / factor), Digits);
          if (HiddenPips > 0) ObjectMove(LineName, 0, Time[0], NewStop);
          if (NewStop - OrderStopLoss() >= Point) modify = true;//George again. What a guy
       }// if (Bid>= sl + (JumpingStopPips / factor) && sl>= OrderOpenPrice())     
    }//if (OrderType()==OP_BUY)
       
    if (OrderType()==OP_SELL)
    {
       if (sl > OrderOpenPrice() ) return;//Not at breakeven yet
       // Decrement sl by sl - JumpingStopPips.
       // This will happen when market price <= (sl - JumpingStopPips)
       //if (Bid<= sl - ((JumpingStopPips*2) / factor)) Original code
       if (CloseEnough(sl, 0) ) sl = MathMin(OrderStopLoss(), OrderOpenPrice());
       if (CloseEnough(sl, 0) ) sl = OrderOpenPrice();
       if (Ask <= sl - ((JumpingStopPips * 2) / factor) )//George
       {
          NewStop = sl - (JumpingStopPips / factor);
          if (AddBEP) NewStop = NormalizeDouble(NewStop - (BreakEvenProfit / factor), Digits);
          if (HiddenPips > 0) ObjectMove(LineName, 0, Time[0], NewStop);
          if (OrderStopLoss() - NewStop >= Point || OrderStopLoss() == 0) modify = true;//George again. What a guy   
       }// close if (Bid>= sl + (JumpingStopPips / factor) && 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 = ModifyOrder(OrderTicket(), OrderOpenPrice(), NewStop, OrderTakeProfit(), OrderExpiration(), clrNONE, __FUNCTION__, slm);  
      if (!result)
      {
         if (OrderType() == OP_BUY)
            Alert(OrderType(), ": Ask = ", DoubleToStr(Ask, Digits), ": Open price", DoubleToStr(OrderOpenPrice(), Digits), ": Old SL = ", DoubleToStr(OrderStopLoss(), Digits), ": New SL = ", DoubleToStr(NewStop, Digits) );
         if (OrderType() == OP_SELL)
            Alert(OrderType(), ": Bid = ", DoubleToStr(Bid, Digits), ": Open price", DoubleToStr(OrderOpenPrice(), Digits), ": Old SL = ", DoubleToStr(OrderStopLoss(), Digits), ": New SL = ", DoubleToStr(NewStop, Digits) );
         Sleep(10000);
      }//if (!result)
          
   }//if (modify)

} //End of JumpingStopLoss sub
Why a command intended to avoid pricing errors should suddenly start producing them is something only the cretins at crapperquotes know. Something they fixed until it broke, maybe?

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
dreambig2
Trader
Posts: 46
Joined: Sat Nov 19, 2016 12:54 am
Location: US

Holy Graily Bob's Candle Power

Post by dreambig2 »

My first code homework....learning time...on it..... :youknow: :good:

Done...compiled...now to test.
Last edited by dreambig2 on Fri Sep 29, 2017 1:30 pm, edited 1 time in total.
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Holy Graily Bob's Candle Power

Post by SteveHopwood »

dreambig2 » Fri Sep 29, 2017 12:00 pm wrote:My first code homework....learning time...on it..... :youknow: :good:
Go for it, Tiger. :clap: :clap: :clap:

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
RisklessPips
Trader
Posts: 246
Joined: Mon May 09, 2016 2:24 pm
Location: Nairobi, Kenya

Holy Graily Bob's Candle Power

Post by RisklessPips »

SteveHopwood » Fri Sep 29, 2017 1:40 pm wrote:
This is a code bloop. Do a search for:
int hour = TimeHour(TimeCurrent() );

This should be:
int hour = TimeHour(TimeLocal() );

TimeCurrent() returns your broker's server time. I will leave you to guess what TimeLocal() returns. :lol:

-----------------------------

It looks as though DC might have solved the invalid stops error thingy in the break even and jumping stop functions. The experimental version has done no harm on my demo and so will become the released version in time for next week. In the meantime, fix the errors by copying these over the top of the existing functions:
Break even

Code: Select all

void BreakEvenStopLoss(int ticket) // Move stop loss to breakeven
{

   //Security check
   if (!BetterOrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES))
      return;
      
   double NewStop;
   bool result;
   bool modify=false;
   string LineName = SlPrefix + DoubleToStr(OrderTicket(), 0);
   double sl = ObjectGet(LineName, OBJPROP_PRICE1);
   double target = OrderOpenPrice();
   
   
   if (OrderType()==OP_BUY)
   {
      if (HiddenPips > 0) target-= (HiddenPips / factor);
      if (OrderStopLoss() >= target) return;
      if (Bid >= OrderOpenPrice () + (BreakEvenPips / factor) )          
      {
         //Calculate the new stop
         NewStop = OrderOpenPrice()+(BreakEvenProfit / factor);
         if (HiddenPips > 0)
         {
            if (ObjectFind(LineName) == -1)
            {
               ObjectCreate(LineName, OBJ_HLINE, 0, TimeCurrent(), 0);
               ObjectSet(LineName, OBJPROP_COLOR, Red);
               ObjectSet(LineName, OBJPROP_WIDTH, 1);
               ObjectSet(LineName, OBJPROP_STYLE, STYLE_DOT);
            }//if (ObjectFind(LineName == -1) )
         
            ObjectMove(LineName, 0, TimeCurrent(), NewStop);         
         }//if (HiddenPips > 0)
         modify = true;   
      }//if (Bid >= OrderOpenPrice () + (Point*BreakEvenPips) && 
   }//if (OrderType()==OP_BUY)               			         
    
   if (OrderType()==OP_SELL)
   {
     if (HiddenPips > 0) target+= (HiddenPips / factor);
      if (OrderStopLoss() <= target && OrderStopLoss() > 0) return;
     if (Ask <= OrderOpenPrice() - (BreakEvenPips / factor) ) 
     {
         //Calculate the new stop
         NewStop = OrderOpenPrice()-(BreakEvenProfit / factor);
         if (HiddenPips > 0)
         {
            if (ObjectFind(LineName) == -1)
            {
               ObjectCreate(LineName, OBJ_HLINE, 0, TimeCurrent(), 0);
               ObjectSet(LineName, OBJPROP_COLOR, Red);
               ObjectSet(LineName, OBJPROP_WIDTH, 1);
               ObjectSet(LineName, OBJPROP_STYLE, STYLE_DOT);
            }//if (ObjectFind(LineName == -1) )
         
            ObjectMove(LineName, 0, Time[0], NewStop);
         }//if (HiddenPips > 0)         
         modify = true;   
     }//if (Ask <= OrderOpenPrice() - (Point*BreakEvenPips) && (OrderStopLoss()>OrderOpenPrice()|| OrderStopLoss()==0))     
   }//if (OrderType()==OP_SELL)

   //Move 'hard' stop loss whether hidden or not. Don't want to risk losing a breakeven through disconnect.
   if (modify)
   {
      if (NewStop == OrderStopLoss() ) return;
      while (IsTradeContextBusy() ) Sleep(100);
      result = ModifyOrder(OrderTicket(), OrderOpenPrice(), NewStop, OrderTakeProfit(), OrderExpiration(), clrNONE, __FUNCTION__, slm);
      if (!result)
         Sleep(10000);//10 seconds before trying again
         
      while (IsTradeContextBusy() ) Sleep(100);
      if (PartCloseEnabled && OrderComment() == TradeComment) bool success = PartCloseOrder(OrderTicket() );
   }//if (modify)
   
} // End BreakevenStopLoss sub
Jumping stop:

Code: Select all

void JumpingStopLoss(int ticket) 
{
   // Jump sl by pips and at intervals chosen by user .

   //Security check
   if (!BetterOrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES))
      return;

   if (OrderProfit() < 0) return;//Nothing to do
   string LineName = SlPrefix + DoubleToStr(OrderTicket(), 0);
   double sl = ObjectGet(LineName, OBJPROP_PRICE1);
   if (CloseEnough(sl, 0) ) sl = OrderStopLoss();
   
   //if (CloseEnough(sl, 0) ) return;//No line, so nothing to do
   double NewStop;
   bool modify=false;
   bool result;
   
   RefreshRates();
   
    if (OrderType()==OP_BUY)
    {
       if (sl < OrderOpenPrice() ) return;//Not at breakeven yet
       // Increment sl by sl + JumpingStopPips.
       // This will happen when market price >= (sl + JumpingStopPips)
       //if (Bid>= sl + ((JumpingStopPips*2) / factor) )
       if (CloseEnough(sl, 0) ) sl = MathMax(OrderStopLoss(), OrderOpenPrice());
       if (Bid >=  sl + ((JumpingStopPips * 2) / factor) )//George{
       {
          NewStop = sl + (JumpingStopPips / factor);
          if (AddBEP) NewStop = NormalizeDouble(NewStop + (BreakEvenProfit / factor), Digits);
          if (HiddenPips > 0) ObjectMove(LineName, 0, Time[0], NewStop);
          if (NewStop - OrderStopLoss() >= Point) modify = true;//George again. What a guy
       }// if (Bid>= sl + (JumpingStopPips / factor) && sl>= OrderOpenPrice())     
    }//if (OrderType()==OP_BUY)
       
    if (OrderType()==OP_SELL)
    {
       if (sl > OrderOpenPrice() ) return;//Not at breakeven yet
       // Decrement sl by sl - JumpingStopPips.
       // This will happen when market price <= (sl - JumpingStopPips)
       //if (Bid<= sl - ((JumpingStopPips*2) / factor)) Original code
       if (CloseEnough(sl, 0) ) sl = MathMin(OrderStopLoss(), OrderOpenPrice());
       if (CloseEnough(sl, 0) ) sl = OrderOpenPrice();
       if (Ask <= sl - ((JumpingStopPips * 2) / factor) )//George
       {
          NewStop = sl - (JumpingStopPips / factor);
          if (AddBEP) NewStop = NormalizeDouble(NewStop - (BreakEvenProfit / factor), Digits);
          if (HiddenPips > 0) ObjectMove(LineName, 0, Time[0], NewStop);
          if (OrderStopLoss() - NewStop >= Point || OrderStopLoss() == 0) modify = true;//George again. What a guy   
       }// close if (Bid>= sl + (JumpingStopPips / factor) && 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 = ModifyOrder(OrderTicket(), OrderOpenPrice(), NewStop, OrderTakeProfit(), OrderExpiration(), clrNONE, __FUNCTION__, slm);  
      if (!result)
      {
         if (OrderType() == OP_BUY)
            Alert(OrderType(), ": Ask = ", DoubleToStr(Ask, Digits), ": Open price", DoubleToStr(OrderOpenPrice(), Digits), ": Old SL = ", DoubleToStr(OrderStopLoss(), Digits), ": New SL = ", DoubleToStr(NewStop, Digits) );
         if (OrderType() == OP_SELL)
            Alert(OrderType(), ": Bid = ", DoubleToStr(Bid, Digits), ": Open price", DoubleToStr(OrderOpenPrice(), Digits), ": Old SL = ", DoubleToStr(OrderStopLoss(), Digits), ": New SL = ", DoubleToStr(NewStop, Digits) );
         Sleep(10000);
      }//if (!result)
          
   }//if (modify)

} //End of JumpingStopLoss sub
Why a command intended to avoid pricing errors should suddenly start producing them is something only the cretins at crapperquotes know. Something they fixed until it broke, maybe?

:xm:
Is this solved problem universal or unique to CP ?

Charles
Trading is a mind game - good job I have a brain
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Holy Graily Bob's Candle Power

Post by SteveHopwood »

RisklessPips » Fri Sep 29, 2017 1:12 pm wrote:
Is this solved problem universal or unique to CP ?

Charles
DC has been getting it with the flavour of Awesome that he is developing. I had never experienced it before CP.

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
RisklessPips
Trader
Posts: 246
Joined: Mon May 09, 2016 2:24 pm
Location: Nairobi, Kenya

Holy Graily Bob's Candle Power

Post by RisklessPips »

SteveHopwood » Fri Sep 29, 2017 3:27 pm wrote: DC has been getting it with the flavour of Awesome that he is developing. I had never experienced it before CP.

:xm:
Hmmm - OK on it I've plugged the BE into GTWV (which had no symptoms) will test it out and report back.

Charles
Trading is a mind game - good job I have a brain
Post Reply

Return to “Thingy Bob EA's”