Need some help with my Awesome Oscillator strategy - EasyLanguage Programming | futures io social day trading
futures io futures trading


Need some help with my Awesome Oscillator strategy
Updated: Views / Replies:491 / 7
Created: by BTGUK Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Need some help with my Awesome Oscillator strategy

  #1 (permalink)
London, United Kingdom
 
 
Posts: 3 since Aug 2018
Thanks: 3 given, 0 received

Need some help with my Awesome Oscillator strategy

Hi All,

I'm new to EasyLanguage, and try to make my first steps in it. My first real attempt to develop my own strategy is this one, which is based on the idea of the Awesome Oscillator indicator and which (if it was working) should scan for a Twin Peaks situation and then buy and sell accordingly.

After spending some time doing modal diagrams and thinking about what the strategy should do, I came up with some EL code. Only - it doesn't seem to do anything. Nothing.

So I'm hoping that someone who's more experienced than me could have a look at my code and tell me where it's going wrong?

Here's the masterpiece

 
Code
Inputs:
		AOShortPeriod(5),
		AOLongPeriod(34),
		NumStocks(100),
		TimeBegin(930),
		TimeEnd(1145),
		ExTime(1245),
		MaxEntry(10);
	

Variables:
		AOLong(0),
		AOShort(0),
		AO(0),
		LwMkr(0),
		HiMkr(0),
		Gd(0),
		Bool Dwnwrd(false),
		Bool Upwrd(false),
		Bool Xdwn(false),
		Bool Xup(false);

	
// Calculate AO

	AOLong = Average((High + Low)/2,AOLongPeriod);
	AOShort = Average((High + Low)/2,AOShortPeriod);
	AO = AOShort - AOLong;

// Detect direction

	Dwnwrd = AO < 0 and AO < AO[1] and AO[1] < AO[2];
	Upwrd = AO > 0 and AO > AO[1] and AO[1] > AO[2];


// Detect Xing

	Xdwn = (AO < 0) and (AO[1] = 0);
	Xup = (AO > 0) and (AO[1] = 0);
	
	
// Compute Running Condition

	If Dwnwrd and Xdwn then Gd = 1;
	If Upwrd and Xup then Gd = 2;
	
	
// Compute Entry	
	
	If (MarketPosition = 0) and (EntriesToday(Date) < MaxEntry) and Time > TimeBegin And Time < TimeEnd Then 
	Begin
		
		If (Gd = 1) then
		Begin
			
			if AO > AO[1] and AO[1] < AO[2] then
			Begin	
				if (LwMkr = 0) or ((LwMkr < 0) and (LwMkr < AO[1])) then LwMkr = AO[1];
				
				if (LwMkr < 0) and (LwMkr > AO[1]) then
				Begin
					Buy ("AOBuy") NumStocks shares next bar at market;
				LwMkr = 0;
				End;
			End;
		
			if AO > 0 then
			Begin
				Gd = 2;
				LwMkr = 0;
			End;
			
		End;

	End;
	
	
	
// Compute Exits
	
	If (MarketPosition = 1) and Time > TimeBegin And Time < TimeEnd Then 
	Begin
		
		If (Gd = 2) then
		Begin
			
			if AO < AO[1] and AO[1] > AO[2] then
			Begin	
				if (HiMkr = 0) or ((HiMkr > 0) and (HiMkr > AO[1])) then HiMkr = AO[1];
				
				if (HiMkr > 0) and (HiMkr < AO[1]) then
				Begin
					Sell ("AOSale") next bar at market;
					HiMkr = 0;
				End;
			End;
		
			if AO < 0 then
			Begin
				Gd = 1;
				HiMkr = 0;
			End;
			
		End;

	End;
	

	If (MarketPosition = 1) and Time > ExTime Then 
	Begin
		Sell ("AOExit") next bar at market;
	End;
Any ideas? Comments? Critique?

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
 Vendor: www.abctradinggroup.com 
Hamburg Germany
 
Trading Experience: Advanced
Platform: Multicharts, Tradestation
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 2,102 since Apr 2013
Thanks: 377 given, 1,346 received


BTGUK,

welcome to futures.io. A good way to find out why a strategy is not behaving like you think it does is using the print reserved word. You would simply add print statements within code blocks and when you execute your code you can see the print statements in the EasyLanguage Output log. This will
Another way is to turn parts of the logic into an input and plot the results, as sometimes it's a lot easier to see what is going on (or better not correctly working) when you have it plotted on a chart.

One thing to check is that AO[1] is actually 0 for some bars. Keep in mind that it might be unlikely that the two averages are exactly the same for one bar i.e. if they are different at the tenth decimal place only your condition would not be valid. If that is the problem, an alternative approach could be to check for AO crossing over and under 0 for example.

Apart from that what chart and interval settings did you apply the strategy to, so one could reproduce what you are seeing?

Regards,

ABCTG

Follow me on Twitter Visit my Facebook Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #4 (permalink)
London, United Kingdom
 
 
Posts: 3 since Aug 2018
Thanks: 3 given, 0 received

Hi ABCTG,

Thanks for your reply!


ABCTG View Post
A good way to find out why a strategy is not behaving like you think it does is using the print reserved word. You would simply add print statements within code blocks and when you execute your code you can see the print statements in the EasyLanguage Output log.

Thanks, I wasn't aware of this print facility, but it sounds like a good tool to probe what's going on in the strategy. I'll have to read more about it and then give it a try.


Quoting 
Another way is to turn parts of the logic into an input and plot the results, as sometimes it's a lot easier to see what is going on (or better not correctly working) when you have it plotted on a chart.

You mean like temporarily disabling (i.e. via curly brackets) conditional routines and setting a fixed condition instead? Certainly worth a try.


Quoting 
One thing to check is that AO[1] is actually 0 for some bars. Keep in mind that it might be unlikely that the two averages are exactly the same for one bar i.e. if they are different at the tenth decimal place only your condition would not be valid. If that is the problem, an alternative approach could be to check for AO crossing over and under 0 for example.

Thanks, I didn't think of that. One fix for that could be to multiply the individual Long and Short Averages by say 1'000'000 and then divide the difference by 1'000'000, i.e. instead

 
Code
// Calculate AO

	AOLong = Average((High + Low)/2,AOLongPeriod);
	AOShort = Average((High + Low)/2,AOShortPeriod);
	AO = AOShort - AOLong;
I use

 
Code
// Calculate AO

	AOLong = (Average((High + Low)/2,AOLongPeriod)) * 1000000);
	AOShort = (Average((High + Low)/2,AOShortPeriod)) * 1000000);
	AO = (AOShort - AOLong) / 1000000;
I assume this would then avoid the issue with deltas less than 1, at least up to the 6th decimal place.


Quoting 
Apart from that what chart and interval settings did you apply the strategy to, so one could reproduce what you are seeing?

Chart settings I tried were line chart, candlestick and candlestick with Momentum, with 15s a 1s intervals. The only study that was open was Awesome Oscillator. The other settings were left at standard for TS 10.

Thanks a lot for your help!

Reply With Quote
 
  #5 (permalink)
 Vendor: www.abctradinggroup.com 
Hamburg Germany
 
Trading Experience: Advanced
Platform: Multicharts, Tradestation
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 2,102 since Apr 2013
Thanks: 377 given, 1,346 received

BTGUK,

I am afraid there is a typo in my reply, I meant to write "Another way is to turn parts of the logic into an indicator and plot the results [...]".

It depends on what you are actually trying to discover when you say Xing. You can also simply check for one indicator crossing over or under the other using the reserved words "crosses over" and "crosses under".
That should effectively eliminate any problems due to a variable not being 0 in the nth decimal place.

Regards,

ABCTG

Follow me on Twitter Visit my Facebook Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #6 (permalink)
Legendary Market Wizard
Houston, TX
 
Trading Experience: Advanced
Platform: XTrader
Broker/Data: Advantage Futures
Favorite Futures: Energy
 
Posts: 3,040 since Dec 2013
Thanks: 2,471 given, 5,456 received


BTGUK View Post
 
Code
// Calculate AO

	AOLong = Average((High + Low)/2,AOLongPeriod);
	AOShort = Average((High + Low)/2,AOShortPeriod);
	AO = AOShort - AOLong;
I use

 
Code
// Calculate AO

	AOLong = (Average((High + Low)/2,AOLongPeriod)) * 1000000);
	AOShort = (Average((High + Low)/2,AOShortPeriod)) * 1000000);
	AO = (AOShort - AOLong) / 1000000;
I assume this would then avoid the issue with deltas less than 1, at least up to the 6th decimal place.

Not really. Try...
 
Code
        AOLong = Average((High + Low)/2,AOLongPeriod);
	AOShort = Average((High + Low)/2,AOShortPeriod);
	AO = Round(AOShort - AOLong, 3);
Or as @ABCTG suggested instead of
 
Code
// Detect Xing

	Xdwn = (AO < 0) and (AO[1] = 0);
	Xup = (AO > 0) and (AO[1] = 0);
you could just use
 
Code
// Detect Xing

	Xdwn = (AO crosses below 0);
	Xup = (AO crosses above 0);

Reply With Quote
The following user says Thank You to SMCJB for this post:
 
  #7 (permalink)
London, United Kingdom
 
 
Posts: 3 since Aug 2018
Thanks: 3 given, 0 received

Thanks again for your help, ABCTG and SMCJB.


ABCTG View Post
BTGUK,

I am afraid there is a typo in my reply, I meant to write "Another way is to turn parts of the logic into an indicator and plot the results [...]".

I see. That's a good idea, however thanks to the help I got so far the basic strategy now seems to work and plots enntry and exit points on my charts.


Quoting 
It depends on what you are actually trying to discover when you say Xing. You can also simply check for one indicator crossing over or under the other using the reserved words "crosses over" and "crosses under".
That should effectively eliminate any problems due to a variable not being 0 in the nth decimal place.

I'm sure you're right. I'm still learning the basics and I now realized that for many things there are actually simple ways to do it.



SMCJB View Post
Not really. Try...
 
Code
        AOLong = Average((High + Low)/2,AOLongPeriod);
	AOShort = Average((High + Low)/2,AOShortPeriod);
	AO = Round(AOShort - AOLong, 3);
Or as @ABCTG suggested instead of
 
Code
// Detect Xing

	Xdwn = (AO < 0) and (AO[1] = 0);
	Xup = (AO > 0) and (AO[1] = 0);
you could just use
 
Code
// Detect Xing

	Xdwn = (AO crosses below 0);
	Xup = (AO crosses above 0);

Thank you very much! After I made all the changes you and ABCTG recommend the strategy seems to work now

Well, at least in general terms, but that's a start. Unfortunately it appears the 'detection' of twin peaks isn't very good, as it seems to often mis-interpret the peaks and settles for minimal changes, so something in my code isn't quite right:

 
Code
// Compute Entry	
	
	If (MarketPosition = 0) and (EntriesToday(Date) < MaxEntry) and Time > TimeBegin And Time < TimeEnd Then 
	Begin
		
		If (Gd = 1) then
		Begin
			
			if AO > AO[1] and AO[1] < AO[2] then
			Begin	
				if (LwMkr = 0) or ((LwMkr < 0) and (LwMkr < AO[1])) then LwMkr = AO[1];
				
				if (LwMkr < 0) and (LwMkr > AO[1]) then
				Begin
					Buy ("AOBuy") NumStocks shares next bar at market;
				LwMkr = 0;
				End;
			End;
		
			if AO > 0 then
			Begin
				Gd = 2;
				LwMkr = 0;
			End;
			
		End;

	End;
Does anyone have an idea how I could improve the 'twin peak' detection above?

Reply With Quote
 
  #8 (permalink)
 Vendor: www.abctradinggroup.com 
Hamburg Germany
 
Trading Experience: Advanced
Platform: Multicharts, Tradestation
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 2,102 since Apr 2013
Thanks: 377 given, 1,346 received

BTGUK,

you are welcome. Can you verbalize and show a screenshot of what scenario you are looking to detect exactly when you say twin peak'? This might help others in pointing you in the right direction.

Regards,

ABCTG


BTGUK View Post
Thanks again for your help, ABCTG and SMCJB.



I see. That's a good idea, however thanks to the help I got so far the basic strategy now seems to work and plots enntry and exit points on my charts.



I'm sure you're right. I'm still learning the basics and I now realized that for many things there are actually simple ways to do it.




Thank you very much! After I made all the changes you and ABCTG recommend the strategy seems to work now

Well, at least in general terms, but that's a start. Unfortunately it appears the 'detection' of twin peaks isn't very good, as it seems to often mis-interpret the peaks and settles for minimal changes, so something in my code isn't quite right:

 
Code
// Compute Entry	
	
	If (MarketPosition = 0) and (EntriesToday(Date) < MaxEntry) and Time > TimeBegin And Time < TimeEnd Then 
	Begin
		
		If (Gd = 1) then
		Begin
			
			if AO > AO[1] and AO[1] < AO[2] then
			Begin	
				if (LwMkr = 0) or ((LwMkr < 0) and (LwMkr < AO[1])) then LwMkr = AO[1];
				
				if (LwMkr < 0) and (LwMkr > AO[1]) then
				Begin
					Buy ("AOBuy") NumStocks shares next bar at market;
				LwMkr = 0;
				End;
			End;
		
			if AO > 0 then
			Begin
				Gd = 2;
				LwMkr = 0;
			End;
			
		End;

	End;
Does anyone have an idea how I could improve the 'twin peak' detection above?


Follow me on Twitter Visit my Facebook Reply With Quote

Reply



futures io > > > > > Need some help with my Awesome Oscillator strategy

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)
 

futures io is celebrating 10-years w/ over $18,000 in prizes!

Right now
 

$250 Amazon Gift Cards with our "Thanks Contest" challenge!

Right now
 

Show us your trading desks and win $1,400 in prizes w/Earn2Trade

November
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help using Awesome Oscillator as a filter protrader007 NinjaTrader Programming 19 August 30th, 2016 04:11 PM
My First EasyLanguage Strategy - Need some help bluefightingcat EasyLanguage Programming 3 September 16th, 2015 11:36 AM
price oscillator bands (works on some charts, but not on others) khmodel NinjaTrader Programming 2 December 9th, 2011 03:04 PM
Awesome Ipad II Ryanb Jokes 1 April 5th, 2011 08:00 AM


All times are GMT -4. The time now is 12:15 AM. (this page content is cached, log in for real-time version)

Copyright © 2019 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts