Gamestudio Links
Zorro Links
Newest Posts
Building Diversified Portfolios - New Paper
by SnoopySniff. 10/18/19 16:23
Indices & metals easier to trade than FX???
by SnoopySniff. 10/18/19 10:08
Today real live account blown - my experience
by SnoopySniff. 10/18/19 09:55
What are you working on?
by txesmi. 10/17/19 07:00
Ducascopy exporter
by line7. 10/17/19 06:21
How to install R ?
by AndrewAMD. 10/17/19 00:56
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
10 registered members (JohnJits, SchokoKeks, Dalla, AndrewAMD, Iglarion, Dooley, painkiller, ugofx, SnoopySniff, 1 invisible), 570 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
VillageTalkies, line7, Shutch, Clifford_B, Paulius
18310 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 20 1 2 3 19 20
One Night Stand System #452807
06/26/15 01:49
06/26/15 01:49
Joined: Feb 2014
Posts: 172
R
RTG Offline OP
Member
RTG  Offline OP
Member
R

Joined: Feb 2014
Posts: 172
I thought I would start coding and testing this somewhat famous strategy. I like that it is invested for a small proportion of time and seems to capture a decent amount of price movement.

From the pdf located at: http://www.forexmt4.com/_MT4_Systems/one%20night%20stand/OneNIghtStand%20Ruleset.pdf

One Night Stand Ruleset:

To show how easy and profitable a Forex trading business can be structured is by viewing the theoretical results of a well-known public system that I've traded ever since Joe Krutsinger gave it to me (and everyone else) at a trading seminar fifteen years ago. It was Joe's custom at every seminar he spoke, to give away the currency trading system One Night Stand to the attendees. He stated only one person in a hundred was able to keep trading it because of a perversity element required. He did say that he believed it worked so well due to the human tendency to resist staying in the currency markets over weekends, and expected it to continue to work well into the future.
I've traded it in the currencies ever since. And the system works just the same as it did a decade and half ago. It isn't hard for me to trade because I'm used to buying new highs and selling new lows. The rules I use are as follows:
● Buy only on Fridays--- at one pip above the highest high of the last ten days--- if the 10 day simple moving average is above the 40 day simple moving average.
● Sell only on Fridays--- at one pip below the lowest low of the last ten days--- if the 10 day simple moving average is below the 40 day simple moving average.
● If you get filled on either rule, exit on Monday morning's open, or Tuesday morning's open, if Monday is a holiday.
Some individuals wish to use a money management stop after entry. This works very well. You can choose any value from 40 to 90 pips for a consistent stop with very little difference in profitability.
As you can see from the equity curves displayed for the various currencies, the system has been working very well since it was released in the late '80's. What is not usually appreciated by those investigating this system is this--- these returns are accomplished staying in the market less than 15% of the time!
Interestingly, a large number of important government reports come out on Fridays, and have for many years. That probably helps the persistence of this trade too. I do believe the main reason One Night Stand still works is for the reasons Joe Krutsinger gave many times from the platform.
Individuals and banking institutions are reluctant to stay heavily positioned over weekends if they don't have to. And they don't have to. So, traders like us pick up a risk premium for doing what others are unwilling to do.

My Zorro coding of this strategy;

function run()
{
// BarPeriod = 60; // Hourly Bars
Verbose = 14;
// Detrend = 1;
vars Price = series(price());
vars SMA10 = series(SMA(Price, 10));
vars SMA40 = series(SMA(Price, 40));

Stop = 90 * PIP;
Capital = 100000;
Margin = 0.01* Capital * sqrt(1 + max(0,WinTotal-LossTotal)/Capital);
// Risk = 0.01 * Capital * sqrt(1 + max(0,WinTotal-LossTotal)/Capital);
//
var BuyLimit,SellLimit,BuyStop,SellStop;

if(SMA10[0] > SMA40[0])
{
BuyStop = HH(10) + 1*PIP;
}

if(SMA10[0] < SMA40[0])
{
SellStop = LL(10) - 1*PIP;
}

if(NumOpenLong < 5 & dow() == 5 & SMA10[0] > SMA40[0])
enterLong(0, BuyStop);
else if(NumOpenShort < 5 & dow() == 5 & SMA10[0] < SMA40[0])
enterShort(0, SellStop);

if(TradeIsOpen and dow() == 1)
exitLong();
if(TradeIsOpen and dow() == 1)
exitShort();

plot("SMA10", SMA10[0], LINE, BLUE);
plot("SMA40", SMA40[0], LINE, ORANGE);
}

Backtest on USD/JPY

BackTest: ONS USD/JPY 2010..2015
Monte Carlo Analysis... Median AR 6%
Profit 4153$ MI 64$ DD 8670$ Capital 11804$
Trades 310 Win 50% Avg +1.8p Bars 3
CAGR 1% PF 1.11 SR 0.20 UI 119% R2 0.00

ONS compiling..................
BackTest: ONS USD/JPY 2010..2015
Monte Carlo Analysis... Median AR 47%
Profit 44180$ MI 674$ DD 11631$ Capital 10431$
Trades 857 Win 54% Avg +6.5p Bars 11
CAGR 7% PF 1.45 SR 0.91 UI 11% R2 0.38

Time in market 30%

Backtest on GBP/USD

Profit 44180$ MI 674$ DD 11631$ Capital 10431$
Trades 857 Win 54% Avg +6.5p Bars 11
CAGR 7% PF 1.45 SR 0.91 UI 11% R2 0.38
Copied to Clipboard!
Generate Chart - please wait... ok

ONS compiling................
BackTest: ONS GBP/USD 2010..2015
Monte Carlo Analysis... Median AR 22%
Profit 20774$ MI 320$ DD 15841$ Capital 8156$
Trades 927 Win 52% Avg +3.9p Bars 10
CAGR 4% PF 1.17 SR 0.42 UI 21% R2 0.50

Time in market 31%

Backtest on EUR/USD

Profit 20774$ MI 320$ DD 15841$ Capital 8156$
Trades 927 Win 52% Avg +3.9p Bars 10
CAGR 4% PF 1.17 SR 0.42 UI 21% R2 0.50
Copied to Clipboard!
Generate Chart - please wait... ok

ONS compiling.................
BackTest: ONS EUR/USD 2010..2015
Monte Carlo Analysis... Median AR 77%
Profit 91711$ MI 1415$ DD 25974$ Capital 10329$
Trades 920 Win 56% Avg +9.9p Bars 10
CAGR 13% PF 1.42 SR 0.98 UI 11% R2 0.44

Time in market 31%

My coding is not perfect. I want to split the timeframe that the run function uses and the timeframe the buy and stop sell functions use.

The buy and sell stop functions should use daily bars. When I coded them with different timeframes the script crashes.

Last edited by RTG; 06/26/15 01:51.
Re: One Night Stand System [Re: RTG] #452812
06/26/15 06:26
06/26/15 06:26
Joined: Apr 2014
Posts: 481
Sydney, Australia
B
boatman Offline
Senior Member
boatman  Offline
Senior Member
B

Joined: Apr 2014
Posts: 481
Sydney, Australia
Why do you need to analyse different time frames? My reading of the system description is that it is based on daily bars?

I set the bar period to 1440 and aligned the bars to midnight. I couldn't reproduce the results in the PDF you linked to. Nothing even close in fact!

Just to make your code a bit simpler:
I don't think you need the if statements around the setting of your buy and sell stops - they are covered in the if statements controlling your trade entries. Also, I don't think you need to limit the number of trades - you can only ever enter one trade in either direction at a time as a result of the strategy's rules.

Good luck! Will be interested to hear if you can reproduce those equity curves.

Re: One Night Stand System [Re: boatman] #452822
06/26/15 14:27
06/26/15 14:27
Joined: Feb 2014
Posts: 172
R
RTG Offline OP
Member
RTG  Offline OP
Member
R

Joined: Feb 2014
Posts: 172
The function HH(10) is analysing the last 10 bars, whereas the system rules should analyse the last 10 days.

How did you align the bars to midnight?

Re: One Night Stand System [Re: RTG] #452825
06/26/15 19:16
06/26/15 19:16
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline
User
Sphin  Offline
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
Proposal for a very basic variation without money management etc.:

Code:
function run() {

BarPeriod = 1440;

vars Price = series(price());
vars SMA10 = series(SMA(Price, 10));
vars SMA40 = series(SMA(Price, 40));

//Stop = 90 * PIP;

var BuyStop,SellStop;

BuyStop = HH(10) + 1*PIP;
SellStop = LL(10) - 1*PIP;

if (dow() == 5 && NumOpenLong == 0 && NumPendingLong == 0 && SMA10[0] > SMA40[0]) 
	enterLong(0,BuyStop);
else if (dow() == 5 && NumOpenShort == 0 && NumPendingShort == 0 && SMA10[0] < SMA40[0])
	enterShort(0,SellStop);			

if (dow() != 5 && dow() != 6 && dow() != 7) {
	exitLong();
	exitShort();
}

}



At least in EUR/USD it looks interessting laugh But you have to omit the Stop, not for weak nerves ...

Re: One Night Stand System [Re: RTG] #452835
06/27/15 02:50
06/27/15 02:50
Joined: Apr 2014
Posts: 481
Sydney, Australia
B
boatman Offline
Senior Member
boatman  Offline
Senior Member
B

Joined: Apr 2014
Posts: 481
Sydney, Australia
Originally Posted By: RTG
The function HH(10) is analysing the last 10 bars, whereas the system rules should analyse the last 10 days.

How did you align the bars to midnight?


There's a script for doing this in the 'Script Tips and Tricks' section of the manual. Very useful!

If you set BarPeriod = 1440, the function HH(10) will analyse the last 10 days.

Re: One Night Stand System [Re: boatman] #452846
06/28/15 08:51
06/28/15 08:51
Joined: Feb 2014
Posts: 172
R
RTG Offline OP
Member
RTG  Offline OP
Member
R

Joined: Feb 2014
Posts: 172
Looks interesting on the pairs "USD/CHF", "USD/JPY" , "GBP/USD", "EUR/USD".

Tried a portoflio loop but the script didn't like it and ran only one pair.

Re: One Night Stand System [Re: RTG] #452854
06/28/15 14:48
06/28/15 14:48
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline
User
Sphin  Offline
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
Just as easy as described in workshop 6:

Code:
function tradeOneNightStand() {
	
vars Price = series(price());
vars SMA10 = series(SMA(Price, 10));
vars SMA40 = series(SMA(Price, 40));

//Stop = 90 * PIP;

var BuyStop,SellStop;

BuyStop = HH(10) + 1*PIP;
SellStop = LL(10) - 1*PIP;

if (dow() == 5 && NumOpenLong == 0 && NumPendingLong == 0 && SMA10[0] > SMA40[0]) 
	enterLong(0,BuyStop);
else if (dow() == 5 && NumOpenShort == 0 && NumPendingShort == 0 && SMA10[0] < SMA40[0])
	enterShort(0,SellStop);			

if (dow() != 5 && dow() != 6 && dow() != 7) {
	exitLong();
	exitShort();
}
	
}


function run() {

BarPeriod = 1440;

while(asset(loop("USD/CHF", "USD/JPY" , "GBP/USD", "EUR/USD")))
	tradeOneNightStand();

}



produces result:

Code:
Portfolio analysis  OptF  ProF  Win/Loss  Wgt%

EUR/USD avg         .501  2.59   44/21    57.7  
GBP/USD avg         .289  1.42   31/26    15.9  
USD/CHF avg         .499  1.28   31/30    12.1  
USD/JPY avg         .466  1.50   32/30    14.2  

EUR/USD             .479  2.59   44/21    57.7  
EUR/USD:L           .278  1.65   14/10    12.7  
EUR/USD:S           .724  3.68   30/11    45.1  
GBP/USD             .297  1.42   31/26    15.9  
GBP/USD:L           .000  0.72   13/16    -6.7  
GBP/USD:S           .578  2.59   18/10    22.6  
USD/CHF             .932  1.28   31/30    12.1  
USD/CHF:L           .999  1.77   17/13    12.8  
USD/CHF:S           .000  0.97   14/17    -0.8  
USD/JPY             .314  1.50   32/30    14.2  
USD/JPY:L           .932  3.32   22/15    26.4  
USD/JPY:S           .000  0.29   10/15   -12.1



Like already mentioned: it's a very basic version ... and in our days I definitely won't advise to keep positions open over the weekend without setting a stop!

Re: One Night Stand System [Re: Sphin] #452862
06/29/15 00:05
06/29/15 00:05
Joined: Feb 2014
Posts: 172
R
RTG Offline OP
Member
RTG  Offline OP
Member
R

Joined: Feb 2014
Posts: 172
So a portfolio loop has to be segregated into at least two seperate functions.

Re: One Night Stand System [Re: RTG] #452865
06/29/15 07:52
06/29/15 07:52
Joined: Jul 2000
Posts: 27,029
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,029
Frankfurt
Functions are used to keep the code orderly. They are unrelated to a portfolio loop.

Re: One Night Stand System [Re: jcl] #452974
07/02/15 15:15
07/02/15 15:15
Joined: Feb 2014
Posts: 172
R
RTG Offline OP
Member
RTG  Offline OP
Member
R

Joined: Feb 2014
Posts: 172
So what about testing this strategy vs a random selection of opening a trade on one day and closing it the next?

Page 1 of 20 1 2 3 19 20

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1