Peaky

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

Peaky

Post by SteveHopwood »

V 1k is in post 1, courtesy of Gary who spotted some improvements he could make.

Gary especially wanted the hidden stop loss to work properly but he spotted a few other things as well. These are the notes he sent me about the edits he made:

Code: Select all


edits to get 'PipsHiddenFromCriminal' working:

	DrawPendingPriceLines()
		added: 'if (OrderType() == OP_SELL || OrderType() == OP_SELLSTOP || OrderType() == OP_SELLLIMIT)' to TpPrefix section

	added function: ModifyHiddenSlTpLines(int ticket, double stop, double take)
	
	edited 'ModifyOrder()' function

----

edits to eliminate 'OrderModify error 1':

	CalculateStopLoss() & CalculateTakeProfit()
		added: 'stop = NormalizeDouble(price - (StopLoss / factor),_Digits);' and 'take = NormalizeDouble(price - (TakeProfit / factor),_Digits);'

	added function: OrderModifyCheck(int ticket, double price, double sl, double tp)
	
	edited 'ModifyOrder()' function
	
----

added function DrawPhlLines()

added to OnInit():
   //draw peak hl lines
	DrawPhlLines();

added to OnDeinit():
	//remove phl_lines
	for(int i = ObjectsTotal() - 1; i >= 0; i--)
	   if (StringFind(ObjectName(i),"phl_",0) > -1) 
	      ObjectDelete(ObjectName(i));

Cheers Gary. :clap: :clap: :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. [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
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

Peaky

Post by renexxxx »

I've done some analysis of this strategy (Peaky) ... (Ignoring shouts of "You should stick to programming rather than thinking about trading strategies ..."). Peaky thrives best on ranging pairs (such as EURGBP, GBPCHF, EURCHF, AUDNZD, EURNOK, EURSEK etc). (This can be determined just by eyeballing the charts) The strategy fails where the market takes of from a range and never looks back. See for instance USDJPY on November 9th, 2016 (Incidentally, this is when our good friend Mr. Trump got into the saddle) :
USDJPY20161109.PNG
On November 9th, 2016, Peaky would have taken a SELL (as price was in the high sixth zone and the peak low was before the peak high). However, after this date, price never returned to the 106 level and it would have taken a long time (even with averaging) to close the basket in a profit.

For this reason, as a test, I created a special type of recovery that aims to close the most negative trade, by offsetting it by one or more positive trades in the basket. As an example see trade 1, 2 and 3 below:
AlternativeRecovery.PNG
(This by the way is not from Peaky -- but it is just to illustrate the method): All the trades in this picture are BUYs. The top-most (trade 1) is in a big loss, whereas trade 2 and 3 are positive. Even if the net profit of the whole basket is negative, it might be possible to close trade 1, 2 and 3 for a small net profit or break even. The next time the price moves down and back up, we can pick up a few new BUYs that can offset the 2nd highest BUY, and so on. So, even when the market has moved to a new price level, oscillations around this new price level can be used to target the most negative trades and thereby moving the break even line closer to the market. In my testing, this form of 'averaging' was better to get out of trouble.

Would be interested in your feedback.
You do not have the required permissions to view the files attached to this post.
peterke
Trader
Posts: 56
Joined: Wed Nov 16, 2011 9:17 am

Peaky

Post by peterke »

Renee - this looks a really interesting idea.

Would you see this recovery being used when the number of open longs is greater than (say a user variable) 5 otherwise existing recovery is used?

rgds
Peter
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

Peaky

Post by renexxxx »

peterke » Tue Jul 04, 2017 5:50 pm wrote: Would you see this recovery being used when the number of open longs is greater than (say a user variable) 5 otherwise existing recovery is used?
Yes, that could be included as a parameter. In any case, the algorithm should first try to close the basket as a whole (in positive), and, failing that, try to just close the most negative trade together with a few positive ones (if the number of trades in the basket exceeds a given parameter).
User avatar
1Direction
Trader
Posts: 97
Joined: Sun Jan 29, 2017 8:37 pm
Location: London

Peaky

Post by 1Direction »

renexxxx » Tue Jul 04, 2017 3:43 am wrote:I've done some analysis of this strategy (Peaky) ... (Ignoring shouts of "You should stick to programming rather than thinking about trading strategies ..."). Peaky thrives best on ranging pairs (such as EURGBP, GBPCHF, EURCHF, AUDNZD, EURNOK, EURSEK etc). (This can be determined just by eyeballing the charts) The strategy fails where the market takes of from a range and never looks back. See for instance USDJPY on November 9th, 2016 (Incidentally, this is when our good friend Mr. Trump got into the saddle) :

On November 9th, 2016, Peaky would have taken a SELL (as price was in the high sixth zone and the peak low was before the peak high). However, after this date, price never returned to the 106 level and it would have taken a long time (even with averaging) to close the basket in a profit.

For this reason, as a test, I created a special type of recovery that aims to close the most negative trade, by offsetting it by one or more positive trades in the basket. As an example see trade 1, 2 and 3 below:
(This by the way is not from Peaky -- but it is just to illustrate the method): All the trades in this picture are BUYs. The top-most (trade 1) is in a big loss, whereas trade 2 and 3 are positive. Even if the net profit of the whole basket is negative, it might be possible to close trade 1, 2 and 3 for a small net profit or break even. The next time the price moves down and back up, we can pick up a few new BUYs that can offset the 2nd highest BUY, and so on. So, even when the market has moved to a new price level, oscillations around this new price level can be used to target the most negative trades and thereby moving the break even line closer to the market. In my testing, this form of 'averaging' was better to get out of trouble.

Would be interested in your feedback.
I think this is the exact logic needed to recover from some problematic trades.

In my current setup with various underlyings (symbols) +/- 80% of the baskets will be closed by the EA for a nice profits and some symbols will experience exactly what you described.

I was thinking of similar approach than yours but went another way and wanted to offset winning symbols against losing ones. When profit is high on a symbol the highest/lowest losers on another symbol could be offset at a total profit while just reducing max profit (multiple winners in a row) from one symbol.

Maybe a combination of your logic over multiple symbols would be the best way to go while maybe way over the top from a programing point of view.

Thanks
User avatar
gprince66
Trader
Posts: 73
Joined: Tue Jan 12, 2016 7:15 am
Location: Austin, TX USA

Peaky

Post by gprince66 »

Excellent idea rene! :good:

I just finished coding the GetVariedLots() function for US members using Peaky_Fifo, so we'll be able to take full advantage of your recovery method.

Looks very promising.

Cheers,

Gary
User avatar
Wavegarrick
Trader
Posts: 1172
Joined: Sun Dec 30, 2012 11:21 am
Location: South Africa

Peaky

Post by Wavegarrick »

I am thinking something like Gridmaster. The direction Rene is heading to control opposite losers against winners ?:good: Nevertheless I could be wrong :youknow:

Cheers
Leon
User avatar
TraderJoeForex
Trader
Posts: 1157
Joined: Fri Mar 08, 2013 10:29 pm
Location: South London

Peaky

Post by TraderJoeForex »

Wavegarrick » Tue Jul 04, 2017 4:57 pm wrote:I am thinking something like Gridmaster. The direction Rene is heading to control opposite losers against winners ?:good: Nevertheless I could be wrong :youknow:

Cheers
Leon
+ 1

...GridMasterPeaky :smile:
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

Peaky

Post by renexxxx »

May be this discussion should be continued on the Peaky on Steroids thread.

What we could do --as an experiment-- is remove all the OrderClose() statements from PoS and remove all the TPs from the OrderSend()'s in PoS. Only allow PoS to open trades, not close. Then install GridMaster on another chart, and let it go wild with the total basket of trades from PoS (over all symbols and across all timeframes). GridMaster targets the biggest loser (one biggest loser at a time) and tries to close that biggest loser by finding a set of winning trades to offset that biggest loser. Not sure if this will work -- as, what we have found in the past is that GridMaster often closes profitable trades too early (before they have reached their full potential). So, if anything, we need PoS to be able to re-instate trades that were closed prematurely by GridMaster.

If this fashion of closing trades proves successful, we can include the GridMaster code into PoS.
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.

Peaky

Post by SteveHopwood »

A brief interjection before leaving you guys to carry on amongst yourselves.

Most of the latest posts here show a fundamental misunderstanding of what Peaky is about. I remind you guys that she is an automation of how I have been trading manually since about the middle of February. She is not one of the usual hopeful off-the-cuff experiments that I normally code.

Before suggesting 'improvements' consider this: I am several months ahead of you guys here. You think you have something better that I can code? Prove it. Run a demo with offsetting along side a demo with Peaky and prove that offsetting is beneficial and I will listen. Peaky is a tireless EA whilst you are mere pathetic mortals who need to sleep, so some block-by-block-of-trades proof will be sufficient. No need to provide an entire account to account comparison.

I am not being harshly critical here - I guess you guys know me well enough to know when I am sticking the boot in. I merely think you are barking at the wrong moon.

Feel free to continue to discuss this here. Just do not expect engagement from me. Peaky is doing what I want her to do, so my work here is done; I shall not interfere.

Also, anyone wants to hack Peaky's code and add in offsetting for experimental purposes, fee free to do so. Have fun along the way.

: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. [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 “Peaky forum”