Jump to content

3 Day SMA/ Down Days Algorithm


Recommended Posts

Hi, I have been experimenting alot with the IG Index API. I find it easy to use. I have recently been toying with ideas for different algo's. I find the idea fascinating.

Anyone got any thoughts on this from a mathematical point of view? Or anyone else interested in this stuff?

  • Three consecutive down days
  • 3 day SMA
  • If the current price is below that 3 Day SMA then sell (There is a reason for the fundamental drop)
  • if the current price is above the 3 Day SMA then Buy (It's held steady, There is support for it)

I've coded this and testing it as we speak. If anyone is interested I will post on Github 

Link to Github Page

Example Output. 

https://pastebin.com/tf26EMG6

  • Like 1
Link to comment
6 minutes ago, TheGuru12 said:

Hi, I have been experimenting alot with the IG Index API. I find it easy to use. I have recently been toying with ideas for different algo's. I find the idea fascinating.

Anyone got any thoughts on this from a mathematical point of view? Or anyone else interested in this stuff?

  • Three consecutive down days
  • 3 day SMA
  • If the current price is below that 3 Day SMA then sell (There is a reason for the fundamental drop)
  • if the current price is above the 3 Day SMA then Buy (It's held steady, There is support for it)

I've coded this and testing it as we speak. If anyone is interested I will post on Github 

Link to Github Page

Example Output. 

https://pastebin.com/tf26EMG6

@jlz 

Link to comment
46 minutes ago, TheGuru12 said:

thanks! I see you use C# I use Python

I am not a big fan of weak typed languages, I don't understand why so many people use Python when there are languages like c++, java and c# available. I do have a python client as well in the repository, but just for the sake of having it , I don't use it.

  • Sad 1
Link to comment
43 minutes ago, jlz said:

I am not a big fan of weak typed languages, I don't understand why so many people use Python when there are languages like c++, java and c# available. I do have a python client as well in the repository, but just for the sake of having it , I don't use it.

 

Python is complex enough to get my head around.  Why do I want to make my life even more difficult by learning a language that requires me to jump through extra hoops to get stuff done?

The Pine editor on TradingView is based on Javascript.  Yet another language to learn to get simple stuff done :(

 

Edited by dmedin
Link to comment
54 minutes ago, dmedin said:

 

Python is complex enough to get my head around.  Why do I want to make my life even more difficult by learning a language that requires me to jump through extra hoops to get stuff done?

The Pine editor on TradingView is based on Javascript.  Yet another language to learn to get simple stuff done :(

 

Python is way more difficult than C#, also slower and error-prone.

Just watch all the messages that are coming in the forum about missing data, function errors, wrong results and so on. You will see that all of them are using Python. Also have a look at the "unofficial" Python repository, it is full of people complaining about its performance. Good luck setting up the streaming API with Python as well.

Python is a language that has been there for so many years and suddenly everyone is using it. Not a single one has compared its performance over multiple systems, they just use it without comparing it with any other language.

Whoever gives C# a chance they never go back to the pain of using Python.

I compare it with people that buy an IPhone and suddenly they want connectivity with other devices. Any shitty android device that cost 50 quid would beat them on that. 


You are free to use it but at least don't say that is easier than C#, because it is not.

Edited by jlz
  • Great! 1
Link to comment
6 minutes ago, jlz said:

Python is way more difficult than C#, also slower and error-prone.

Just watch all the messages that are coming in the forum about missing data, function errors, wrong results and so on. You will see that all of them are using Python. Also have a look at the "unofficial" Python repository, it is full of people complaining about its performance. Good luck setting up the streaming API with Python as well.

Python is a language that has been there for so many years and suddenly everyone is using it. Not a single one has compared its performance over multiple systems, they just use it without comparing it with any other language.

Whoever gives C# a chance they never go back to the pain of using Python.

I compare it with people that buy an IPhone and suddenly they want connectivity with other devices. Any shitty android device that cost 50 quid would beat them on that. 


You are free to use it but at least don't say that is easier than C#, because it is not.

 

How much longer have you got before Microshit 'deprecates' it in favour of the latest and the greatest?

Link to comment
Just now, dmedin said:

 

How much longer have you got before Microshit 'deprecates' it in favour of the latest and the greatest?

C# does not depend on Microsoft, there are many companies developing the framework, simply because it improved their processes over the years so much that they don't want to leave it behind. 

Think about the  c++ can be considered the fastest language out there, c# is now at  a level of optimization that can compete with c++, even at the expense of using a non-native runtime. So I don't think it is going away anytime soon.

  • Great! 1
Link to comment

woah! Easy chaps (I presume) ... I just talked about my algo idea. Each to their own. I agree I have faced issues with a lot of things in Python. Some resolved by the IG Helpdesk but it works for me. Anywho. I will prepare a github repo with my code if anyone Interested. Perhaps people can contribute to the idea. I just wanted to see if anyone though it was a feasible idea 

  • Great! 1
Link to comment
2 minutes ago, TheGuru12 said:

woah! Easy chaps (I presume) ... I just talked about my algo idea. Each to their own. I agree I have faced issues with a lot of things in Python. Some resolved by the IG Helpdesk but it works for me. Anywho. I will prepare a github repo with my code if anyone Interested. Perhaps people can contribute to the idea. I just wanted to see if anyone though it was a feasible idea 

:D it is all part of the usual banter/discussion. There is no harm intended. Just bored folks trying to be clever over a few big words. 

  • Great! 2
Link to comment
On 10/09/2020 at 15:08, jlz said:

I am not a big fan of weak typed languages, I don't understand why so many people use Python when there are languages like c++, java and c# available. I do have a python client as well in the repository, but just for the sake of having it , I don't use it.

I'm a C#, Java developer, but I love doing Python + AWS for my "trading projects" that I have started working (learning) on in the beginning of the quarantine. It's so faster to prototype something and most of the prototypes I can just deploy to production afterwards since speed is not of importance.

Also another reason I started learning Python this year is this:

Stackoverflow 2019 developer survey:

Quote
  • Python, the fastest-growing major programming language, has risen in the ranks of programming languages in our survey yet again, edging out Java this year and standing as the second most loved language (behind Rust).

 

Link to comment
7 hours ago, SonnyCrockett said:

I'm a C#, Java developer, but I love doing Python + AWS for my "trading projects" that I have started working (learning) on in the beginning of the quarantine. It's so faster to prototype something and most of the prototypes I can just deploy to production afterwards since speed is not of importance.

Also another reason I started learning Python this year is this:

Stackoverflow 2019 developer survey:

 

I have a Raspberry Pi 4b and I play with Python constantly. Recently I got this Robot Arm toy and connected it to the Pi:

https://owirobot.com/robotic-arm-edge/

I know Python has become a popular language but that is just because of the power of the open source community. There are so many libraries out there that makes the development a very easy task. But that doesn't make it a reliable language for trading. I don't think it should be used because of its dynamic typing. It is quite slow as well so I don't know how it would work for HFT with streaming services.

One of our problems is that we get bored with what we have and we keep learning new languages. So python is popular now. Then it will be Rust or Go, or any of the 1000 open source languages out there. But trading firms will still deploy their main applications with strong typed languages looking for a reliable execution. C++ and C# are hard to beat at that.

  • Sad 1
Link to comment
3 hours ago, jlz said:

I know Python has become a popular language but that is just because of the power of the open source community. There are so many libraries out there that makes the development a very easy task.

I would add it is because of the popularity of the packages that are used in data science. Comparing the numbers of modules in all package managers Python doesn't stand out. First there is NPM for Javascript way above and then there is everyone else.

I think there is just too much ceremony involved in OO languages to get basic math concepts working. You don't need to know about polymorphism, inheritance, abstract classes, constructors, interfaces static & instance data types...if all you want to do is  crunch some numbers.

I enjoyed learning Python a lot more than I enjoyed learning subtle differences between C# and Java.

Some other stuff I really like in Python:

  • Parsing JSON. It feels so natural. In Java & C# I would spent 1 day to find the best framework, then create all the objects to map JSON data, in Python JSON is just a dictionary data structure. It is 1 line to convert JSON string into a dictionary and then you just use the dictionary syntax to read/write data.
  • It teaches you to write tests. You need tests for everything, knowing that there is no compiler to back you up, your code coverage needs to be a lot higher than when working with strongly typed languages.
  • You just open a file and start writing code, without the need to declare any classes, static main functions, configure the project with what to run etc...
Quote

But trading firms will still deploy their main applications with strong typed languages looking for a reliable execution. C++ and C# are hard to beat at that.

Agree. But we are not trading firms building platforms for thousands of consumers. So to each his own :)

Sorry for hijacking the thread @TheGuru12 :)

Link to comment
29 minutes ago, SonnyCrockett said:
  • Parsing JSON. It feels so natural. In Java & C# I would spent 1 day to find the best framework, then create all the objects to map JSON data, in Python JSON is just a dictionary data structure. It is 1 line to convert JSON string into a dictionary and then you just use the dictionary syntax to read/write data.

It cannot be easier to parse JSON into classes in C#.

Just create a .cs file and use the option "Paste Json as classes in Visual Studio", then a simple line with Newtonsoft will have your object ready. 

var yourClass = JsonConvert.DeserializeObject<T>(json)

image.png.ccdb17963bd11ffc7445d38165b867f1.png

A day to parse a JSON object?, you just have to use the right tools. It takes 5 minutes and you end with a full object with proper nested types in a hierarchy. Not to mention that everything is strong-typed as well as included in the intellisense helper.

And you are going to tell me that you prefer hard-coding strings as keys to get them from a dictionary? Come on...

 

 

 

Edited by jlz
  • Like 1
Link to comment

Auto code generators are so 2000's :). I'm at a point of my career where "no code" wins over "automatically generated code" every time for me. If the price of having 0 mapping objects in contrast to 20 (as you would need for a rest api with 10 endpoints - request, response) is that you loose strong types (what most people are annoyed is that there is no intelli sense or auto complete to help you) then I'm willing to pay that price. I'll cover my **** with tests anyway.

No seriously, as I said I'm a C# developer mainly, but I'm not in denial that popularity of C# and Java have been in decline for the last 10 years. MS has this tendency to screw things up, I love C# as I loved Windows Phones back in the day...

I never used C++ professionally, would love to, but there is only that many hours in a day...

Link to comment
2 hours ago, SonnyCrockett said:

Auto code generators are so 2000's :). I'm at a point of my career where "no code" wins over "automatically generated code" every time for me. If the price of having 0 mapping objects in contrast to 20 (as you would need for a rest api with 10 endpoints - request, response) is that you loose strong types (what most people are annoyed is that there is no intelli sense or auto complete to help you) then I'm willing to pay that price. I'll cover my **** with tests anyway.

No seriously, as I said I'm a C# developer mainly, but I'm not in denial that popularity of C# and Java have been in decline for the last 10 years. MS has this tendency to screw things up, I love C# as I loved Windows Phones back in the day...

I never used C++ professionally, would love to, but there is only that many hours in a day...

I started this morning a c++ repo. Let's see how far I get. I couldn't find any code samples for c++ in order to connect to the IG API so if you guys want to step in and review the code I would love to hear your comments.

I haven't developed in c++ as much as I have in c#, so take it easy on me :D 

https://github.com/oneangrytrader/brokerapiclients

  • Sad 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • image.png

  • Posts

    • Elliott Wave Analysis TradingLounge Daily Chart, NEO / U.S. dollar(NEOUSD) NEOUSD Elliott Wave Technical Analysis Function: Counter Trend Mode: Corrective Structure: Double Corrective Position: Wave Y Direction Next higher Degrees: Wave (II) of Impulse Wave Cancel invalid Level: 9.85 Details: Wave (II) is likely to have ended and prices are resuming the uptrend.   NEO / U.S. dollar(NEOUSD)Trading Strategy: It looks like the wave (II) correction is complete and the price is still likely to move up. Look for an opportunity to join the wave (III) uptrend. NEO / U.S. dollar(NEOUSD)Technical Indicators: The price is below the MA200 indicating a downtrend, The Wave Oscillator is a Bearish Momentum. Elliott Wave Analysis TradingLounge H4 Chart, NEO / U.S. dollar(NEOUSD) NEOUSD Elliott Wave Technical Analysis Function: Counter Trend Mode: Corrective Structure: Double Corrective Position: Wave Y Direction Next higher Degrees: Wave (II) of Impulse Wave Cancel invalid Level: 9.85 Details: Wave (II) is likely to have ended and prices are resuming the uptrend. NEO / U.S. dollar(NEOUSD)Trading Strategy: It looks like the wave 2 correction is complete and the price is still likely to move up. Look for an opportunity to join the wave 3 uptrend. NEO / U.S. dollar(NEOUSD)Technical Indicators: The price is below the MA200 indicating a downtrend, The Wave Oscillator is a Bearish Momentum. Technical Analyst : Kittiampon Somboonsod Source : Tradinglounge.com get trial here!  
    • Stock Market Indices Overview: S&P 500, NASDAQ 100, RUSSELL 2000, DAX 40, FTSE 100, ASX 200 - Featuring Elliott Wave Technical Analysis Our latest analysis focuses on the key global stock market indices, including the S&P 500, NASDAQ 100, RUSSELL 2000, DAX 40, FTSE 100, and ASX 200, through the lens of Elliott Wave Theory. This approach provides insights into market trends, helping traders identify potential setups for both entry and exit points across these major markets. Elliott Wave Analysis for Major Indices: As we approach the upcoming Federal Reserve meeting in just six days, all eyes are on the U.S. economy. The upcoming PPI (Producer Price Index) figures represent the final significant economic data point that the Federal Reserve will consider before making its next rate decision. The market's reaction to this data could set the tone for how the major indices move in the short term. At present, I am analyzing two possible wave counts for the indices: 1. Wave (2) Low in Place: This scenario suggests that the corrective wave has completed, and the market is now poised to rally higher. 2. Wave (2) Not Yet Complete: Alternatively, there is still room for further downside before Wave (2) concludes. Currently, I lean toward the bullish scenario, as the price action in leading stocks like Amazon (AMZN) and Microsoft (MSFT) suggests underlying strength in the broader market. However, I remain flexible in my outlook, awaiting further confirmation from key market movements and the PPI data to finalize this wave structure. Video Chapters  00:00 SP 500 (SPX) 08:17 NASDAQ (NDX) 11:54 Russell 2000 (RUT) IWM ETF 13:03 DAX 40 (DAX) 16:13 FTSE 100 UKX (UK100) 17:23 S&P/ASX 200 (XJO) 22:39 End Analyst Peter Mathers TradingLounge Source: tradinglounge com   
×
×
  • Create New...
us