Jump to content

3 Day SMA/ Down Days Algorithm


Recommended Posts

Posted

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
Posted
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 

Posted
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
Posted (edited)
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
Posted

Ah but Python is obsolete.  Now it's Rust, Go, Dart, F4rt, Poopy Buttcheeks etc etc etc.

Just an endless proliferation of languages, frameworks, la-de-da and cupcakes 😘🤪

Posted (edited)
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
Posted
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?

Posted
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
Posted

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
Posted
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
Posted
2 hours ago, jlz said:

Interesting, I can see in the log when they are opened, do you have a log of when they are closed and the profit they've made?

I am working on that bit. 

Posted
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).

 

Posted
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
Posted
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 :)

Posted (edited)
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
Posted

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...

Posted
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

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

    • While Popcat (POPCAT) and Mogcoin (MOG) have earned their places as top cat coins with impressive growth—POPCAT surging over 7000% and MOG jumping 15000%—both are nearing their market cap saturation points. POPCAT has already crossed a $1 billion market cap, and MOG is close behind. As these well-established meme coins face challenges replicating past explosive gains, a new opportunity arises in the form of CatSlap ($SLAP). Catslap (SLAP) is the new feline in town. The new Ethereum-based meme coin recorded a 2000% jump in just 48 hours of listing. CatSlap ($SLAP) is set to shake up the meme coin market with its unique features and community-driven approach. With its fair launch on decentralized exchanges (DEX), an interactive slapping game called Slapometer, and gamified rewards like the Slap to Earn Airdrop, CatSlap is designed to captivate both new and experienced investors. The token’s 9 billion supply is strategically allocated to liquidity, community rewards, and staking incentives, emphasizing transparency and security. With meme coins gaining popularity, CatSlap ($SLAP) offers a fresh alternative for those looking for new meme coins that could potentially deliver substantial growth. As the meme coin space continues to evolve, CatSlap is positioned to become the next big thing, promising an exciting and interactive experience for its growing community. CatSlap ($SLAP) debuted with a fair launch on Uniswap, ensuring that its token price is purely determined by market demand. Unlike many other projects, there were no presales, early investor perks, or insider deals, giving new investors a fair shot at potential returns. This transparent approach means that all participants enter on equal footing, with no preferential treatment given to select groups. By launching directly on a decentralized exchange (DEX), CatSlap reduces the risks often associated with market price manipulation by whales, making it a more secure and community-driven investment. With no inflated token prices from presale events or early allocations, the fair launch model fosters trust and provides a solid foundation for long-term growth. This focus on transparency and equal access positions CatSlap as an attractive option for those looking for an exciting new meme coin with fair market dynamics. CatSlap ($SLAP) Tokenomics Breakdown The tokenomics of CatSlap ($SLAP) are designed to ensure stability, growth, and long-term success. Here's how the total supply of 9 billion $SLAP tokens is allocated: 50% to Liquidity: This allocation ensures that trading remains smooth, even during volatile market rallies, allowing for quick buy and sell transactions. 20% for Passive Rewards: A significant portion of tokens is reserved to reward holders, promoting engagement and retention within the community. 10% for Community Incentives: Tokens are set aside to incentivize community participation, enhancing the project's growth and creating a vibrant ecosystem. 10% for Development: This portion supports ongoing development and project improvements, ensuring CatSlap’s evolution and scalability. 10% Vested for the Team (over 10 years): The team has locked up 10% of the supply for 10 years, demonstrating their long-term commitment. The vested tokens ensure they stay aligned with the success of the project and are incentivized to work consistently on its development. For more accurate details about CatSlap token, upcoming and ongoing crypto ICOs, you can visit their Coinpedia Launchpad and search for CatSlap listings on various cryptocurrency platforms and social media channels for updates and participation instructions and also find details about other crypto presales, new crypto projects and crypto launchpad calendars.
    • ASX: COMPUTERSHARE LIMITED. - CPU Elliott Elliott Wave Technical Analysis TradingLounge Greetings, Our Elliott Wave analysis today updates the Australian Stock Exchange (ASX) with COMPUTERSHARE LIMITED. - CPU. We see ASX:CPU nearing the completion of wave ((i))-navy and a pullback to wave ((ii))-navy is expected in the near term. ASX: COMPUTERSHARE LIMITED. - CPU 1D Chart (Semilog Scale) Analysis Function: Major trend (Minor degree, grey) Mode: Motive Structure: Impulse Position: Wave ((i))-navy of Wave 3-grey Details: Wave 3-grey is unfolding to push higher. It is subdividing into wave ((i))-navy itself, and it will continue to push higher, after which a pullback with wave ((ii))-navy will await. Invalidation point: 24.68 ASX: COMPUTERSHARE LIMITED. - CPU 4-Hour Chart Analysis Function: Major trend (Minute degree, navy) Mode: Motive Structure: Impulse Position: Wave a-grey of Wave (iv)-orange of Wave ((i))-navy Details: Wave (iii)-orange has completed as a five-wave labeled from wave i-grey to wave v-grey, now it is time for wave (iv)-orange to push lower, it is expected to target around 30.57, after which wave (v)-orange may continue to advance higher.  Invalidation point: 26.79 Conclusion: Our analysis, forecast of contextual trends, and short-term outlook for ASX: COMPUTERSHARE LIMITED. - CPU aim to provide readers with insights into the current market trends and how to capitalize on them effectively. We offer specific price points that act as validation or invalidation signals for our wave count, enhancing the confidence in our perspective. By combining these factors, we strive to offer readers the most objective and professional perspective on market trends. Technical Analyst: Hua (Shane) Cuong, CEWA-M (Master’s Designation). Source : Tradinglounge.com get trial here! #CPU #TradingLounge #ASXStocks #Stocks #ElliottWave  
    • Elliott Wave Analysis TradingLounge Binancecoin/ U.S. dollar(BNBUSD) BNBUSD Elliott Wave Technical Analysis Function: Counter Trend Mode: Corrective Structure: Flat position: Wave A Direction Next higher Degrees: wave (2) Wave Cancel invalid level: Details: Retracement of wave A before Pull-back in wave B. Binancecoin/ U.S. dollar(BNBUSD)Trading Strategy: Wave (1) appears to have ended and price is now entering a correction phase in wave (2), so wait for the correction to complete to rejoin the trend. Binancecoin/ U.S. dollar(BNBUSD)Technical Indicators: The price is above the MA200 indicating an uptrend, The Wave Oscillator is a Bullish Momentum. Binancecoin/ U.S. dollar(BNBUSD) BNBUSD Elliott Wave Technical Analysis Function: Counter Trend Mode: Corrective Structure: Flat position: Wave A Direction Next higher Degrees: wave (2) Wave Cancel invalid level: Details: Retracement of wave A before Pull-back in wave B Binancecoin/ U.S. dollar(BNBUSD)Trading Strategy: Wave (1) appears to have ended and price is now entering a correction phase in wave (2), so wait for the correction to complete to rejoin the trend. Binancecoin/ U.S. dollar(BNBUSD)Technical Indicators: The price is above the MA200 indicating an uptrend, The Wave Oscillator is a Bullish Momentum. Technical Analyst : Kittiampon Somboonsod Source : Tradinglounge.com get trial here!  
×
×
  • Create New...
us