Gamestudio Links
Zorro Links
Newest Posts
Specular Shader
by Dooley
Yesterday at 22:03
about series
by Petra
Yesterday at 08:08
Steam Bundle
by Dooley
Yesterday at 01:48
Asset list
by JamesHH
05/24/19 17:45
If I have $100 USD how can I start
by SnoopySniff
05/24/19 14:58
Return current bar in Unix time
by jcl
05/24/19 13:04
What are you working on?
by Dooley
05/24/19 00:07
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
3 registered (AndrewAMD, Dbat, Seymour), 437 Guests and 6 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
tnt19, Mohammadamine, aduqab, Reza65, Pritamchakra
18227 Registered Users
Page 1 of 20 1 2 3 ... 19 20 >
Topic Options
Rate This Topic
#452807 - 06/26/15 03:49 One Night Stand System
RTG Offline
Member

Registered: 02/23/14
Posts: 171
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.


Edited by RTG (06/26/15 03:51)

Top
#452812 - 06/26/15 08:26 Re: One Night Stand System [Re: RTG]
boatman Offline
Senior Member

Registered: 04/23/14
Posts: 481
Loc: 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.
_________________________
www.robotwealth.com

Top
#452822 - 06/26/15 16:27 Re: One Night Stand System [Re: boatman]
RTG Offline
Member

Registered: 02/23/14
Posts: 171
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?

Top
#452825 - 06/26/15 21:16 Re: One Night Stand System [Re: RTG]
Sphin Offline
User

Registered: 12/11/13
Posts: 567
Loc: 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 ...

Top
#452835 - 06/27/15 04:50 Re: One Night Stand System [Re: RTG]
boatman Offline
Senior Member

Registered: 04/23/14
Posts: 481
Loc: 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.
_________________________
www.robotwealth.com

Top
#452846 - 06/28/15 10:51 Re: One Night Stand System [Re: boatman]
RTG Offline
Member

Registered: 02/23/14
Posts: 171
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.

Top
#452854 - 06/28/15 16:48 Re: One Night Stand System [Re: RTG]
Sphin Offline
User

Registered: 12/11/13
Posts: 567
Loc: 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!

Top
#452862 - 06/29/15 02:05 Re: One Night Stand System [Re: Sphin]
RTG Offline
Member

Registered: 02/23/14
Posts: 171
So a portfolio loop has to be segregated into at least two seperate functions.

Top
#452865 - 06/29/15 09:52 Re: One Night Stand System [Re: RTG]
jcl Offline

Chief Engineer

Registered: 07/22/00
Posts: 26870
Loc: Frankfurt
Functions are used to keep the code orderly. They are unrelated to a portfolio loop.

Top
#452974 - 07/02/15 17:15 Re: One Night Stand System [Re: jcl]
RTG Offline
Member

Registered: 02/23/14
Posts: 171
So what about testing this strategy vs a random selection of opening a trade on one day and closing it the next?

Top
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