Slopey Peaky Bob

Post Reply
spymez
Trader
Posts: 18
Joined: Wed Feb 29, 2012 1:33 pm

Slopey Peaky Bob

Post by spymez »

Thanks for the update Steve.

Wishing you and all SHF members a Happy and Profitable 2020. :good:
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Slopey Peaky Bob

Post by SteveHopwood »

There is an update to the core library in post 1.

Scaling back in needs code to prevent scale in trades bing sent with a stop loss. Search for:
newPrice = NormalizeDouble(calculatedLevel + slLevel, digits);

Add this block underneath@

Code: Select all

               if (HideStopLossAndTakeProfit)
               {
                  stop = 0;
                  take = 0;
               }//if (HideStopLossAndTakeProfit)
:xm: :rocket:
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. [email protected] 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
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Slopey Peaky Bob

Post by SteveHopwood »

There is a further update to the core library in post 1.

I put the edit in the wrong place, meaning it would only work with sell stop scale in trades. Delete it from its current location then do a search for: double newPrice = 0;

Insert this immediately below:

Code: Select all

            if (HideStopLossAndTakeProfit)
            {
               stop = 0;
               take = 0;
            }//if (HideStopLossAndTakeProfit)
Save the file - we do not compile .mqh files. Then recompile SPB and all should be well.

:xm: :rocket:
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. [email protected] 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
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Slopey Peaky Bob

Post by SteveHopwood »

I have added a check that all the pairs in our PairsToTrade input are offered by the broker, to the core library file in post 1.

Copy this over the top of the existing void extractPairs() function if you want to DIY.

Code: Select all

void extractPairs()
{
   
   int cc = 0;
   
   //Read the pairs into a temporary array so that 
   //pairs not offered by the broker are removed.
   string tempTradePair[];
   StringSplit(PairsToTrade,',',tempTradePair);
   noOfPairs = ArraySize(tempTradePair);
   int tempIndex = 0;
   
   //Save the pairs offered by the broker into the tradePair array.
   for (cc = 0; cc < noOfPairs; cc ++)
   {
      string symbol = tempTradePair[cc];
      symbol = StringTrimLeft(symbol);
      symbol = StringTrimRight(symbol);
      symbol = StringConcatenate(PairPrefix, symbol, PairSuffix);
      
      getBasics(symbol);//Returns zero for the Bid if the symbol is not offered.
      if (!closeEnough(bid, 0) )
      {
         tempIndex++;
         ArrayResize(tradePair, tempIndex);
         tradePair[tempIndex - 1] = symbol;
         
      }//if (!closeEnough(bid, 0) )
     
   }//for (cc = 0; cc < noOfPairs; cc ++)
   
   
   
   
   
   // Resize the arrays appropriately
   ArrayResize(ttfCandleTime, noOfPairs);
   ArrayResize(htfSsStatus, noOfPairs);
   ArrayResize(htfSsVal, noOfPairs);
   ArrayResize(mtfSsStatus, noOfPairs);
   ArrayResize(mtfSsVal, noOfPairs);
   ArrayResize(ltfSsStatus, noOfPairs);
   ArrayResize(ltfSsVal, noOfPairs);
   ArrayResize(buySignal, noOfPairs);
   ArrayResize(sellSignal, noOfPairs);
   ArrayResize(timeToStartTrading, noOfPairs);
   ArrayResize(oldHtfIndiReadBarTime, noOfPairs);
   ArrayResize(oldMtfIndiReadBarTime, noOfPairs);
   ArrayResize(oldLtfIndiReadBarTime, noOfPairs);
   ArrayResize(spreadArray, noOfPairs);
   ArrayInitialize(spreadArray, 0);
   ArrayResize(pipsUpl, noOfPairs);
   ArrayInitialize(pipsUpl, 0);
   ArrayResize(cashUpl, noOfPairs);
   ArrayInitialize(cashUpl, 0);
   ArrayResize(buyTradeTotals, noOfPairs);
   ArrayInitialize(buyTradeTotals, 0);
   ArrayResize(sellTradeTotals, noOfPairs);
   ArrayInitialize(sellTradeTotals, 0);
   ArrayResize(closedBuyTradeTotals, noOfPairs);
   ArrayInitialize(closedBuyTradeTotals, 0);
   ArrayResize(closedSellTradeTotals, noOfPairs);
   ArrayInitialize(closedSellTradeTotals, 0);
   ArrayResize(peakyStatus, noOfPairs);
   ArrayResize(buyCashUpl, noOfPairs);
   ArrayResize(sellCashUpl, noOfPairs);
   

   
   for (cc = 0; cc < noOfPairs; cc ++)
   {
      
      timeToStartTrading[cc] = 0;
      oldHtfIndiReadBarTime[cc] = 0;
      oldMtfIndiReadBarTime[cc] = 0;
      oldLtfIndiReadBarTime[cc] = 0;
      
      //Average spread
      spreadGvName=tradePair[cc] + " average spread";
      spreadArray[cc][averagespread]=GlobalVariableGet(spreadGvName);//If no gv, then the value will be left at zero.
      //Create a Global Variable with the current spread if this does not already exist
      if (closeEnough(spreadArray[cc][averagespread], 0))
      {
         getBasics(tradePair[cc]);//Includes the current spread
         spreadArray[cc][averagespread] = NormalizeDouble(spread, 2);
         GlobalVariableSet(spreadGvName, spread);
      }//if (closeEnough(spreadArray[cc][averagespread], 0))
      
      //Longterm spread
      spreadGvName=tradePair[cc] + " longterm spread";
      spreadArray[cc][longtermspread]=GlobalVariableGet(spreadGvName);//If no gv, then the value will be left at zero.
      //Create a Global Variable with the current spread if this does not already exist
      if (closeEnough(spreadArray[cc][longtermspread], 0))
      {
         getBasics(tradePair[cc]);//Includes the current spread
         spreadArray[cc][longtermspread] = NormalizeDouble(spread, 2);
         GlobalVariableSet(spreadGvName, spread);
      }//if (closeEnough(spreadArray[cc][averagespread], 0))
      
      spreadArray[cc][previousask] = 0;//Used to update the tick counter when there is a price change
      
   }//for (int cc; cc<noOfPairs; cc ++)

   //Swap pairs
   if (BuyOnlyPairs != "")
   {
      StringSplit(BuyOnlyPairs,',',buyOnlyPairs);
      noOfBuyOnlyPairs = ArraySize(buyOnlyPairs);
      //Remove accidental spaces
      for (cc = 0; cc < noOfBuyOnlyPairs; cc++)
      {
         StringTrimLeft(buyOnlyPairs[cc] );
         StringTrimRight(buyOnlyPairs[cc] );
         buyOnlyPairs[cc] = StringConcatenate(PairPrefix, buyOnlyPairs[cc], PairSuffix);
      }//for (cc = 0; cc <= noOfBuyOnlyPairs - 1; cc++)      
   }//if (BuyOnlyPairs != "")
   
   if (SellOnlyPairs != "")
   {
      StringSplit(SellOnlyPairs,',',sellOnlyPairs);
      noOfSellOnlyPairs = ArraySize(sellOnlyPairs);
      //Remove accidental spaces
      for (cc = 0; cc <= noOfSellOnlyPairs - 1; cc++)
      {
         StringTrimLeft(sellOnlyPairs[cc] );
         StringTrimRight(sellOnlyPairs[cc] );
         sellOnlyPairs[cc] = StringConcatenate(PairPrefix, sellOnlyPairs[cc], PairSuffix);
      }//for (cc = 0; cc <= noOfSellOnlyPairs - 1; cc++)      
   }//if (SellOnlyPairs != "")
   

   //'Bigger picture' pairs
   if (PairsToTradeLongOnly != "")
   {
      StringSplit(PairsToTradeLongOnly,',',longOnlyPairs);
      noOfLongOnlyPairs = ArraySize(longOnlyPairs);
      //Remove accidental spaces
      for (cc = 0; cc < noOfLongOnlyPairs; cc++)
      {
         StringTrimLeft(longOnlyPairs[cc] );
         StringTrimRight(longOnlyPairs[cc] );
         longOnlyPairs[cc] = StringConcatenate(PairPrefix, longOnlyPairs[cc], PairSuffix);
      }//for (cc = 0; cc <= longOnlyPairs - 1; cc++)      
   }//if (PairsToTradeLongOnly != "")
   
   if (PairsToTradeShortOnly != "")
   {
      StringSplit(SellOnlyPairs,',',shortOnlyPairs);
      noOfSellOnlyPairs = ArraySize(shortOnlyPairs);
      //Remove accidental spaces
      for (cc = 0; cc <= noOfSellOnlyPairs - 1; cc++)
      {
         StringTrimLeft(shortOnlyPairs[cc] );
         StringTrimRight(shortOnlyPairs[cc] );
         shortOnlyPairs[cc] = StringConcatenate(PairPrefix, shortOnlyPairs[cc], PairSuffix);
      }//for (cc = 0; cc <= noOfSellOnlyPairs - 1; cc++)      
   }//if (PairsToTradeShortOnly != "")
  
}//End void extractPairs()
:xm: :rocket:
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. [email protected] 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
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Slopey Peaky Bob

Post by SteveHopwood »

There is another update to the SPB core library.mqh Include file in post 1.

Scale-in stop orders are supposed to be deleted if the original trade hits its stop loss and closes, whether this is a 'hard' or a 'hidden' sl. This is not happening. I have been wracking my brains to see how to adapt the existing closure code and eventually hit upon a much simpler idea.

DIYers, add this pending order deletion function where ever is convenient:

Code: Select all

void deleteOrphanedStopOrders(string symbol, int type, int pairIndex)
{

   //This function deletes pending orders when they are no longer required  
   
   for (int cc = OrdersTotal() - 1; cc >= 0; cc--)
   {
      bool TradeWasClosed = false;//See 'check for possible trade closure'

      //Ensure the trade is still open
      if (!betterOrderSelect(cc, SELECT_BY_POS, MODE_TRADES) ) continue;

      
      //Ensure the EA 'owns' this trade
      if (OrderMagicNumber() != MagicNumber) continue;
      if (OrderType() != type) continue; 
      if (OrderSymbol() != symbol ) continue;

      bool result = OrderDelete(OrderTicket(), clrNONE);
      if (result)
      {
         cc++;
      }//if (result)

   }//for (int cc = OrdersTotal() - 1; cc >= 0; cc--)
   
   
   //Rebuild a picture of the position
   countOpenTrades(symbol, pairIndex);
   
}//Endvoid deleteOrphanedStopOrders(string symbol, int type, int pairIndex)


Then do a search for this comment: //Scaling back in will leave stop orders behind if a trade hits SL,

Copy this over the top of the existing code block:
//Scaling back in will leave stop orders behind if a trade hits SL,
//so they need deleting.
if (UseScaleBackIn)
{
if (buyStopOpen)
if (marketBuysCount == 0)
deleteOrphanedStopOrders(symbol, OP_BUYSTOP, pairIndex);

if (sellStopOpen)
if (marketSellsCount == 0)
deleteOrphanedStopOrders(symbol, OP_SELLSTOP, pairIndex);

}//if (UseScaleBackIn)

Recompile the relevant tribe member and see if it works properly now.

:xm: :rocket:
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. [email protected] 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
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Slopey Peaky Bob

Post by SteveHopwood »

Lately, I have dealt with a moron unable to read Desky's user guide and another unable to read SPB's user guide. He was stupid enough to send me a pm about this. He is not going to enjoy my reply.

They both made the same stupid mistake of being unable to work out the Friday global basket closure thingy.

Only an idiot tries to use either of these EA's without fully understanding how they work. They are not toys for simpletons. I believe I might have mentioned this from time to time? In passing? Tangentially?

Understanding the EA's involves reading the fucking user guides. PROPERLY. I wrote the bloody things so I would not have to answer moronic questions posted by lazy and stupid space-wasters.

I put you on notice folks, that I will ban people whining that their Friday global basket take profit displays are wrong, and delete their registration here. Read the bloody manual and work this stuff out for yourselves.
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. [email protected] 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
raffus
Posts: 3
Joined: Sun Aug 23, 2015 4:57 pm

Slopey Peaky Bob

Post by raffus »

hi to everybody
i'm a newbie, fxtestify supporter. :clap:

i opened a cent account with some money, can anybody help me in order to find the right value of "sizeofdollop" ?

I'm not greedy, I would like to find the right compromise between gain and drawdown, I'd like to have a 2/3% monthly.

thanks a lot to all people of this forum
best regards
User avatar
Gertje
Trader
Posts: 1936
Joined: Mon Dec 12, 2011 1:17 pm
Location: Middle of the Netherlands

Slopey Peaky Bob

Post by Gertje »

raffus » Thu Jan 30, 2020 8:15 pm wrote:hi to everybody
i'm a newbie, fxtestify supporter. :clap:

i opened a cent account with some money, can anybody help me in order to find the right value of "sizeofdollop" ?

I'm not greedy, I would like to find the right compromise between gain and drawdown, I'd like to have a 2/3% monthly.

thanks a lot to all people of this forum
best regards
What value is Thomas using on his demo account which shows in FXTestify?
I believe it is 0.01/$10.000 which delivers appr. 10% monthly.
So start with 0.01/$30.000 and you'll be fine.... :smile:
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Slopey Peaky Bob

Post by SteveHopwood »

The latest version of the core library is in post 1. This addressed the issue I posted about earlier in Desky's thread. Read about it at viewtopic.php?p=169475#p169475

The code is the same as Desky's but has to be placed in different locations here, along with adding a new function to the library. Find the new code by doing a search for this comment: "//Scale back in sltp correction" to take you to the code. "

:xm: :rocket:
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. [email protected] 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
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Bloop alert

Post by SteveHopwood »

I have had to update the core library code. Read the explanation at viewtopic.php?p=169481#p169481

DIYers, do not follow the directions in Desky's post; they are slightly different here.

Do a search for: GlobalVariableSet(gvFileName, hiddenTake);

Here the two variables in the VlobalVariableSet() command need swapping around - it will be obvious that the first block is dealing with the stop loss and the second with the take profit.

There is no need to repeat the search - the code is correct for the sell trade code.

:xm: :rocket:
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. [email protected] 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.
Post Reply

Return to “Super Slope EA's”