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

Holy Graily Bob's Candle Power
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5272
Page 15 of 36
Author:  gtactual [ Fri Sep 29, 2017 1:25 am ]
Post subject:  Holy Graily Bob's Candle Power

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.
Author:  pipcruiser [ Fri Sep 29, 2017 10:34 am ]
Post subject:  Holy Graily Bob's Candle Power

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]
Author:  dreambig2 [ Fri Sep 29, 2017 11:07 am ]
Post subject:  Holy Graily Bob's Candle Power

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:
Author:  eaymon [ Fri Sep 29, 2017 11:34 am ]
Post subject:  Holy Graily Bob's Candle Power

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
Author:  SteveHopwood [ Fri Sep 29, 2017 11:40 am ]
Post subject:  Holy Graily Bob's Candle Power

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:
Author:  dreambig2 [ Fri Sep 29, 2017 12:00 pm ]
Post subject:  Holy Graily Bob's Candle Power

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

Done...compiled...now to test.
Author:  SteveHopwood [ Fri Sep 29, 2017 12:26 pm ]
Post subject:  Holy Graily Bob's Candle Power

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:
Author:  RisklessPips [ Fri Sep 29, 2017 1:12 pm ]
Post subject:  Holy Graily Bob's Candle Power

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
Author:  SteveHopwood [ Fri Sep 29, 2017 1:27 pm ]
Post subject:  Holy Graily Bob's Candle Power

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:
Author:  RisklessPips [ Fri Sep 29, 2017 1:31 pm ]
Post subject:  Holy Graily Bob's Candle Power

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
All times are UTC Page 15 of 36