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

    • The digital landscape is undergoing a profound transformation as attention, once a freely given commodity, is increasingly recognized as a valuable asset. Layer3 is at the forefront of this revolution, pioneering a new economy where attention can be owned, traded, and monetized   This innovative approach empowers individuals to monetize their engagement, providing unprecedented control over personal data. Simultaneously, advertisers benefit from transparent metrics that optimize campaign performance. Content creators are presented with diverse revenue avenues beyond traditional advertising, while the overall ecosystem experiences a more equitable distribution of value.   The implications of Layer3 extend across various sectors. Social media platforms, for instance, can leverage this technology to revolutionize user engagement and monetization strategies. Tokenomics play a crucial role in driving Layer3's economy, incentivizing participation and rewarding value creation. While challenges such as data privacy and market volatility exist, the potential benefits of Layer3 are immense   Anticipation is building as its native token $L3 is on Bitget Pre-market as users await its listing on the exchange. This milestone is expected to significantly increase the token's visibility and accessibility, potentially driving substantial growth and attracting new investors. As the countdown begins, the crypto community watches with keen interest, eager to see how Layer3 will perform in this new chapter.
    • I've been exploring the world of play-to-earn gaming recently, looking for something that's not just about endless grinding but actually offers a fun and rewarding experience. OGC really stood out to me because it combines gaming with a sense of community in a unique way. OGC isn't just a game; it's a platform where you can play, earn, and even help shape its future. You're not just a player; you're part of a community with a voice. The idea of earning crypto while playing games is exciting, but what makes OGC special is its focus on community involvement. Your feedback can directly influence the development of the game, which is a big deal. I've also heard that the OGC token is available for pre-market trading on Bitget. While I'm still getting to know the platform and its features, it's definitely something to keep an eye on. Has anyone else tried OGC? What has your experience been like? I'd love to hear your thoughts and any tips you might have.
    • I am anticipating the impact of this listing on Mongy. 
×
×
  • Create New...
us