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

Peaky on Steroids
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5204
Page 5 of 97
Author:  SteveHopwood [ Mon Jun 26, 2017 8:57 pm ]
Post subject:  Peaky on Steroids

V 1c is in post 1. Never mind how, but Thomas set me looking for the possible cause of some of the invalid stop errors. I did a search for Symbol(), which should normally be replaced by symbol, just as ask replaces Ask, bid replaces Bid and so on.

We can ignore the instances of Symbol() in void CalculateLotAsAmountPerCashDollops(). So far as I know, MODE_LOTSTEP is a platform wide thingy, not pair specific.

I found one that does matter. Line 1924:
result = SendSingleTrade(Symbol(), OP_BUYSTOP, TradeComments[dd], SendLots, price, stop, take, MagicNumbers[dd]);

should be:
result = SendSingleTrade(OrderSymbol(), OP_BUYSTOP, TradeComments[dd], SendLots, price, stop, take, MagicNumbers[dd]);

Also DIYers, copy this from Thomas over the top of the existing void CheckPricesAreStillValid(int cc) function:

Code: Select all

void CheckPricesAreStillValid(int cc)
{

   //Examine pending trades and adjust the price if the peak has moved by 1 pip or more.
   if (!BetterOrderSelect(LatestTradeTicketNo, SELECT_BY_TICKET, MODE_TRADES) )
      return;
   
   double price = 0, newPrice = 0;
   bool modify = false;
   double stop = 0, take = 0;
      
   //A buy stop will be above the lowest trade line
   if (OrderType() == OP_BUYSTOP)
   {
       price = PeakLowTradingLines[cc];
       if (OrderOpenPrice() - price > (1 / factor) )
         if (bid < price + (TradeBuffers[cc] / factor) )
         {
            modify = true;
            newPrice = price + (TradeBuffers[cc] / factor);
            stop = CalculateStopLoss(OP_BUY, newPrice, cc);
            take = CalculateTakeProfit(OP_BUY, newPrice, cc);
         }//if (bid < price + (TradeBuffers[cc] / factor) )
   }//if (OrderType() == OP_BUYSTOP)
         
   //A sell stop will be below the highest trade line
   if (OrderType() == OP_SELLSTOP)
   {
       price = PeakHighTradingLines[cc];
       if (price - OrderOpenPrice() > (1 / factor) )
         if (bid > price - (TradeBuffers[cc] / factor) )
         {
            modify = true;
            newPrice = price - (TradeBuffers[cc] / factor);
            stop = CalculateStopLoss(OP_SELL, newPrice, cc);
            take = CalculateTakeProfit(OP_SELL, newPrice, cc);
         }//if (OrderOpenPrice() - price > (1 / factor) )
   }//if (OrderType() == OP_SELLSTOP)
         
   if (!modify)
      return;
      
   bool result = ModifyOrder(OrderTicket(), newPrice, stop, take, OrderExpiration(), clrNONE, __FUNCTION__, oop);

}//void CheckPricesAreStillValid(int cc)
:xm:
Author:  SteveHopwood [ Mon Jun 26, 2017 9:03 pm ]
Post subject:  Peaky on Steroids

renexxxx » Mon Jun 26, 2017 8:07 pm wrote: As a possible improvement for version 1c (or later), it would be good to include a (timeframe-specific) swap filter: since we expect particularly the longer timeframes to be in a drawdown for an extended period, before the market turns back, we might only want to open trades in their positive swap direction.

But I'm sure this has already been considered.
It is on my horizon along with tf specific lot sizes to help our US friends. From what I have read, FIFO only affects trades with equivalent lot sizes, so a positive swap only filter allied with tf specific lot sizes will make PoS much more available to US traders.

:xm:
Author:  Dexonite [ Mon Jun 26, 2017 9:08 pm ]
Post subject:  Peaky on Steroids

Might it be that some of the invalid stops are caused by using the sixth as tp. I mean on a smaller time frame the sixths sometimes are really small and if you add buffer pips to that you might already be over the tp sixth line or does it just use the next, I guess that would be the middle, sixth line for tp?
Author:  SteveHopwood [ Mon Jun 26, 2017 10:07 pm ]
Post subject:  Peaky on Steroids

The weirdest thing has happened to V 1c, so I have removed it from post 1.

The OnInit() function has vanished.

To save me reconstructing it by hand, can one of you post it, please?

:xm:
Author:  Zool [ Mon Jun 26, 2017 10:12 pm ]
Post subject:  Peaky on Steroids

SteveHopwood » Mon Jun 26, 2017 11:07 pm wrote:The weirdest thing has happened to V 1c, so I have removed it from post 1.

The OnInit() function has vanished.

To save me reconstructing it by hand, can one of you post it, please?

:xm:
Here you go:

Code: Select all

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{

   //User message
   Comment("                              INITIALISING. PLEASE WAIT.");
   
   //Set up the doubles variables that replace the unser integer inputs
   Trade1TakeProfit = Trade1TakeProfitPips;
   Trade1StopLoss = Trade1StopLossPips;
   Trade1Buffer = Trade1BufferPips;
   Trade2TakeProfit = Trade2TakeProfitPips;
   Trade2StopLoss = Trade2StopLossPips;
   Trade2Buffer = Trade2BufferPips;
   Trade3TakeProfit = Trade3TakeProfitPips;
   Trade3StopLoss = Trade3StopLossPips;
   Trade3Buffer = Trade3BufferPips;
   Trade4TakeProfit = Trade4TakeProfitPips;
   Trade4StopLoss = Trade4StopLossPips;
   Trade4Buffer = Trade4BufferPips;   
   MarketDistance = MarketDistancePips;
   
   
   
//--- create timer
   EventSetTimer(EventTimerIntervalSeconds);
   
   //Extract the pairs traded by the user
   ExtractPairs();
   //Populate all the arrays
   PopulateTheArrays();

   Gap="";
   if (DisplayGapSize > 0)
      StringInit(Gap, DisplayGapSize, ' ');
   
//---
   return(INIT_SUCCEEDED);
}
Author:  SteveHopwood [ Mon Jun 26, 2017 10:21 pm ]
Post subject:  Peaky on Steroids

This is really weird. Scrolling down through the code to replace Zool's OnInit I came across this:
int OnInit(), with all the code in place but masked by the red dot.

And that dot really is red.

Not even the merest beginnings of the slightest hint of the opening gambit of a clue what happened there.

1c is back in post 1. You do not need it if your V1c is running fine - must have been something strange happening on my machine.

Probably the more criminally inclined of the crims trying to derail us. :lol:

:xm:
Author:  tomele [ Mon Jun 26, 2017 10:34 pm ]
Post subject:  Peaky on Steroids

SteveHopwood » 26 Jun 2017, 23:21 wrote:This is really weird. Scrolling down through the code to replace Zool's OnInit I came across this:
int OnInit(), with all the code in place but masked by the red dot.

And that dot really is red.

Not even the merest beginnings of the slightest hint of the opening gambit of a clue what happened there.

1c is back in post 1. You do not need it if your V1c is running fine - must have been something strange happening on my machine.

Probably the more criminally inclined of the crims trying to derail us. :lol:

:xm:
OnInit() still not working. No EA feedback on the screen. Delete this red dot in the source code like a character and it works.

Cheers
Author:  goodo [ Mon Jun 26, 2017 10:48 pm ]
Post subject:  Peaky on Steroids

tomele » Mon Jun 26, 2017 10:34 pm wrote:
OnInit() still not working. No EA feedback on the screen. Delete this red dot in the source code like a character and it works.

Cheers
Fantastic.
Demo working now.
Author:  tomele [ Mon Jun 26, 2017 10:55 pm ]
Post subject:  Peaky on Steroids

baddo » 26 Jun 2017, 23:48 wrote:
tomele » Mon Jun 26, 2017 10:34 pm wrote:
OnInit() still not working. No EA feedback on the screen. Delete this red dot in the source code like a character and it works.

Cheers
Fantastic.
Demo working now.
And way in the green today. Another brilliant work of master Steve. Presumably the masterpiece. Until now.

:clap: :clap: :clap:
Author:  SteveHopwood [ Mon Jun 26, 2017 11:26 pm ]
Post subject:  Peaky on Steroids

tomele » Mon Jun 26, 2017 10:34 pm wrote:
SteveHopwood » 26 Jun 2017, 23:21 wrote:This is really weird. Scrolling down through the code to replace Zool's OnInit I came across this:
int OnInit(), with all the code in place but masked by the red dot.

And that dot really is red.

Not even the merest beginnings of the slightest hint of the opening gambit of a clue what happened there.

1c is back in post 1. You do not need it if your V1c is running fine - must have been something strange happening on my machine.

Probably the more criminally inclined of the crims trying to derail us. :lol:

:xm:
OnInit() still not working. No EA feedback on the screen. Delete this red dot in the source code like a character and it works.

Cheers
O for fucks sake, what does it take?

I have uploaded 1c yet again to post 1. I am starting to lose the will to live.

If you have no feedback on your chart then the bot is not working because of that fucking red dot. Do some learning for once folks, load the blasted source code into your bloody code editor, find the fucking red dot, delete it and recompile.

And if you do not know how to do the above, then bloody well learn how to. It is about fucking time you did. Only a cretin does battle with Empty4 without learning the basics of coding.

And do not even bother to have bad dreams about my reaction to you bleating, "But I am too busy."

Old stagers here might be sensing a certain level of irritation here. Hey ho.

:xm:
All times are UTC Page 5 of 97