Awesome - original version

The place for Peaky and Peaky-related stuff.
Post Reply
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.

Awesome - original version

Post by SteveHopwood »

DigitalCrypto » Wed Sep 27, 2017 12:03 pm wrote:@Steve,

I did notice that AO is skipping the movement of some stoplosses when BE or JS has been more than reached. For example there will be two trades well into profit. One order's stop will get moved to BE. The other doesn't do anything.

I can see that the trade management module is being called correctly. What I can't see is why it ignores some orders but not others.

I wanted to bring it up in case you had an "aha" idea that you knew about already.
It could be the spread filter. Do a search for "if (!SpreadOk(pairsIndex) )//Spread is too wide, so do not want the EA doing anything." to take you to the code block and add:

Alert(symbol, " paused during a wide spread event");

above 'continue'. The block will look like this:

Code: Select all

      if (!SpreadOk(pairsIndex) )//Spread is too wide, so do not want the EA doing anything.
      {
         Alert(symbol, " paused during a wide spread event");
         continue;
      }//if (!SpreadOk(pairsIndex) )
This will confirm whether it is the spread or not.

: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.
DigitalCrypto
Trader
Posts: 237
Joined: Tue Feb 24, 2015 4:38 am

Awesome - original version

Post by DigitalCrypto »

Yep. Thank you. I will check it out.

I made it a print statement that I can watch in real time on the console so I can track it while it's happening, IF it is happening.

This thing produces so many Alerts Im afraid to add one more. :D

EDIT: Of course wouldn't you know now that I said something about it....it seems to be working correctly so far.
User avatar
Kopan
Trader
Posts: 15
Joined: Mon Apr 17, 2017 9:12 pm
Location: U.S.A.

Awesome - original version

Post by Kopan »

DC,
I noticed that your "Outlaw" setfile defaults to 24 hour trading.

Are you still trading <only the London Session> as you did with your prior versions or is it really 24 hours?

Thanks for the clarification,
Kopan

DigitalCrypto » Wed Sep 27, 2017 4:32 am wrote:Ain't that the truth. It has always been my understanding that traders should be coders. It just takes me a bit to wrap my head around it. The arrays...I don't want to talk about arrays.

BTW here's my Awesome "Outlaw" edition set file. It's booked about almost 4k pips since this weekly open.

Definitely worth setting up a demo account and watching this thing go. I'd appreciate any help and suggestions that can improve it.
DigitalCrypto
Trader
Posts: 237
Joined: Tue Feb 24, 2015 4:38 am

Awesome - original version

Post by DigitalCrypto »

Hey Kopan,

My testing didn't seem to work like I had originally planned. That set file is for the original AO. I need to send some stuff to Steve for review.

I couldn't get FIFO working correctly either. FIFO will work if trades are stacking in the direction of the trend and new trades are lower or higher than prior trades. But you would still need to close out the first trade before closing out later trades.

As an aside, I found one of the main reasons that USA switched to 50:1 and FIFO via a NFA (National Futures Association) law suit. Apparently Gain Capital (forex.com) was switching leverage from 200:1 on Fridays to 100:1 and manually margin calling customers. Instead of taking only a small part of the position they would often liquidate the entire position. The 50:1 and FIFO stopped all brokers from being able to participate in this particular type of scam.
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.

Awesome - original version

Post by SteveHopwood »

This is no big deal folks; just an edit you might like to make to the code.

I am adding a couple of requests to PoS; one of them involves coding the candle open time stuff from PoS, so I am copying it across. I came across this block:

Code: Select all

   //I do not know of any way of resizing a 2 dimensional array, so store
   //each bar open time in an array of the number of pairs being traded * the no of time frames.
   ArrayResize(TradingBarTime, NoOfPairs * tfTotal);
   ArrayInitialize(TradingBarTime, 0);
  
The comment refers to before I got my thick skull around multi-field arrays. As coded, this will create umpteen more array members than required. You can save some computer memory by changing:

ArrayResize(TradingBarTime, NoOfPairs * tfTotal);

to:

ArrayResize(TradingBarTime, NoOfPairs);

This is line 1107 in the code in front of me.

: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.
DigitalCrypto
Trader
Posts: 237
Joined: Tue Feb 24, 2015 4:38 am

Awesome - original version

Post by DigitalCrypto »

Much appreciated Steve :D
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.

Awesome - original version

Post by SteveHopwood »

Folks, DC has just pm'd me with an idea about the invalid stops error.

Any of you guys using the break even and/or jumping stop features and getting the invalid stop errors?

: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
1Direction
Trader
Posts: 97
Joined: Sun Jan 29, 2017 8:37 pm
Location: London

Awesome - original version

Post by 1Direction »

Can't get global basket closure

I tried all I possibly could even started to look into the code but I simply can't have awesome v1m close at my basketcashtakeprofit value.

I even tried looking into the relevant part of the code to see if I'm missing some conditions for a global basket closure but not being a coder I couldn't find anything that would help me understand what I'm missing.

here my relevant set file settings

Trade1AsBasket=true
Trade1BasketCashTarget=10
Trade1BasketCashPercentageTarget=0.0

AllTradesBelongToBasket=true
BasketCashTakeProfit=4.0
BasketCashPercentageTarget=0

I tried both
Trade1AsBasket=true and Trade1AsBasket=false

The relevant code as far as I could understand it

Code: Select all

bool HaveWeReachedGlobalBasketTP()
{

   //Close all trades on the platform if a full basket tp is hit.
   double BasketProfitTarget = BasketCashTakeProfit;
      
   //Calculate the dynamic tp
   if (!CloseEnough(BasketCashPercentageTarget, 0) )
      BasketProfitTarget = (AccountBalance() * BasketCashPercentageTarget) / 100;
      
   if (EntirePositionCashUpl >= BasketProfitTarget)
      return (true);
         
   //Not reached the target
   return(false);
   
}//bool HaveWeReachedGlobalBasketTP()


   //Have we reached a whole platform basket target?
   if (AllTradesBelongToBasket)
   {
      if (HaveWeReachedGlobalBasketTP() )
      {
         Alert("Global profit target reached. All trades should have closed.");
         NuclearOption();
         //All trades must be closed, so keep banging away until they are.
         if (ForceTradeClosure)
         {
            while (ForceTradeClosure)
            {
               NuclearOption();
               if (ForceTradeClosure)
                  Sleep(5000);//5 seconds
            }//while (ForceTradeClosure)
            
         }//if (ForceTradeClosure)
         
      }//if (HaveWeReachedGlobalBasketTP() )
      
   
   }//if (AllTradesBelongToBasket)


//All trades on the platform belong to the same basket
   EntirePositionCashUpl = 0;

   
   int type;//Saves the OrderType() for consulatation later in the function
   
   
   if (OrdersTotal() == 0) return;
   
   //Iterating backwards through the orders list caters more easily for closed trades than iterating forwards
   for (int cc = OrdersTotal() - 1; cc >= 0; cc--)
   {
      bool TradeWasClosed = false;//See 'check for possible trade closure'

      //Ensure the trade is still open
      if (!OrderSelect(cc, SELECT_BY_POS, MODE_TRADES) ) continue;
      
      EntirePositionCashUpl+= OrderProfit() + OrderSwap() + OrderCommission();
      
      //Ensure the EA 'owns' this trade
      if (OrderSymbol() != symbol) continue;
      if (OrderMagicNumber() != magic) continue;
      
      //The time of the most recent trade
      if (OrderOpenTime() > LatestTradeTime)
      {
         LatestTradeTime = OrderOpenTime();
         LatestTradeTicketNo = OrderTicket();
      }//if (OrderOpenTime() > LatestTradeTime)
      
      //The time of the earliest trade
      if (OrderOpenTime() < EarliestTradeTime)
      {
         EarliestTradeTime = OrderOpenTime();
         EarliestTradeTicketNo = OrderTicket();
      }//if (OrderOpenTime() < EarliestTradeTime)
      
      //All conditions passed, so carry on
      type = OrderType();//Store the order type
      
      
      //Store the latest trade sent. Most of my EA's only need this final ticket number as either they are single trade
      //bots or the last trade in the sequence is the important one. Adapt this code for your own use.
      

   DisplayUserFeedback();
   
}//End void OnTimer()
I would like to close all positions NuclearOption when the combined open positions is > than 4 (BasketCashTakeProfit=4.0)

I'm using TradeReport to track the profit and can witness it goes way pass my BasketCashTakeProfit value without awesome closing all positions.

What is wrong with me? Any help greatly appreciated.

Thanks 1D

Side note, this set file generated +600 demo € net profit since 1st September!!
You do not have the required permissions to view the files attached to this post.
DigitalCrypto
Trader
Posts: 237
Joined: Tue Feb 24, 2015 4:38 am

Awesome - original version

Post by DigitalCrypto »

My buddy is having a blast with AO.

One of the things he mentioned to me is that it runs for the most part very well without touching it. However he would like the confidence knowing that everything could go to hell in a moment's notice and he wouldn't care because he had protected his new balance amount. As an added benefit he could check on it from time-to-time and ratchet up the ProtectBalanceAmount as he saw fit.

Proposed functionality: (Untested)

Code: Select all

   extern string  bal1="================================================================";
   extern string  bal="---- Account Balance Protection ----";
   extern bool    ProtectBalance = false;                  //Use Emergency balance protection?
   extern double  ProtectBalanceAmount = "1.00";   //We fall under this amount and close everything

  
   //Balance Protection
   if(ProtectBalance)
   {
      if(AccountProfit() < 0)
      if(AccountBalance() - AccountProfit() <= ProtectBalanceAmount)
      {
         Alert("Account Balance Protection Triggered. All trades should have closed.");
         NuclearOption();
         //All trades must be closed, so keep banging away until they are.
         if (ForceTradeClosure)
         {
            while (ForceTradeClosure)
            {
               NuclearOption();
               if (ForceTradeClosure)
                  Sleep(5000);//5 seconds
            }//while (ForceTradeClosure)
         Alert("Expert Unloaded!");
         ExpertRemove();   
         }//if (ForceTradeClosure)
      }//if(AccountBalance - AccountProfit() <= ProtectBalanceAmount)   
   }//if(ProtectBalance)

Seems like a good idea. Any comments or ideas? :D
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.

Awesome - original version

Post by SteveHopwood »

DigitalCrypto » Thu Sep 28, 2017 8:59 pm wrote:My buddy is having a blast with AO.

One of the things he mentioned to me is that it runs for the most part very well without touching it. However he would like the confidence knowing that everything could go to hell in a moment's notice and he wouldn't care because he had protected his new balance amount. As an added benefit he could check on it from time-to-time and ratchet up the ProtectBalanceAmount as he saw fit.

Proposed functionality: (Untested)

Code: Select all

   extern string  bal1="================================================================";
   extern string  bal="---- Account Balance Protection ----";
   extern bool    ProtectBalance = false;                  //Use Emergency balance protection?
   extern double  ProtectBalanceAmount = "1.00";   //We fall under this amount and close everything

  
   //Balance Protection
   if(ProtectBalance)
   {
      if(AccountProfit() < 0)
      if(AccountBalance() - AccountProfit() <= ProtectBalanceAmount)
      {
         Alert("Account Balance Protection Triggered. All trades should have closed.");
         NuclearOption();
         //All trades must be closed, so keep banging away until they are.
         if (ForceTradeClosure)
         {
            while (ForceTradeClosure)
            {
               NuclearOption();
               if (ForceTradeClosure)
                  Sleep(5000);//5 seconds
            }//while (ForceTradeClosure)
         Alert("Expert Unloaded!");
         ExpertRemove();   
         }//if (ForceTradeClosure)
      }//if(AccountBalance - AccountProfit() <= ProtectBalanceAmount)   
   }//if(ProtectBalance)

Seems like a good idea. Any comments or ideas? :D
Does no harm, but by the time the account balance falls below x, the equity would already have gone to Hell in a hand basket and the margin call would have reduced the account balance to below x anyhow.

There might be some point to changing this to the account equity but here is the rub: the Black Swan event that we are discussing here overwhelms everything, including the crapform's ability to cope with the information being flung at it.

I may be wrong, but as I see it the only way to avoid disaster in these situations is to follow Bob's mantra of trade so you can trade another day. This usually involves:
  • tiny lot sizes.
  • frequent profit withdrawals.
And my mantra: never trade with funds you cannot afford to lose. From there: double the account and withdraw your original stake so you are playing with money you did not have in the first place; you really can afford to lose that, however much it would hurt.

Imagining that an EA can protect us from Black Swan events is naive. The moon your friend is barking at etc

: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.
Post Reply

Return to “Peaky forum”