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
  • General Statistics

    • Total Topics
      23,597
    • Total Posts
      96,959
    • Total Members
      44,166
    • Most Online
      7,522
      10/06/21 10:53

    Newest Member
    lol
    Joined 03/12/23 01:36
  • Posts

    • Trade statistics of the 'Triangle 8th' system as of 12/03/2023 Gain: 102.00% Profit: 781.52 USD Funds: 1,400.18 USD Balance: 1,781.52 USD Beginning deposit: 1,000.00 USD Withdrawals: 0.00 USD Top-ups: 0.00 USD
    • Name of stock - Vox Royalty   Name of Stock Exchange - NASDAQ   Leverage or Share dealing - Leverage   Ticker - VOXR   Country of the stock - Usa   Market Cap - 100M
    • It is a best practice to buy dip and sell high but this strategy mostly doesn’t go as planned because you can’t predict the final bottom. Some traders BTD anticipating a potential pullback which mostly doesn’t happen and this force some into panic selling. DYOR is mostly advisable but some people fail to know which analysis they should focus more on. When deciding to hold a token for a long-term FA is very important and its cardinal point should be thoroughly scrutinized before making such a decision. These points include; Whitepaper, Road map, and Usecase. These points have a huge impact on deciding how long to hold a project and also booast your confidence in the project's bullish potential.  The first principle in this industry is “invest what you can afford to lose" though many neglect this principle as such when a project is going through a price correction they panic sell and sell at a huge lost. Most normal regret their decision later when they see the project back on track. Once you adhere to the first principle you hardly fall victim to panic sales. Note that it is mostly not advisable to hold meme tokens una less you are convinced because meme goes with the hype and finds it hard to retest its ATH once the hype is over.  Anyway what are your trading strategy and principles you adhere to most?
×
×
  • Create New...
us