Any C++ programmers willing to help modify RTDMan?

mastermind007

Well-Known Member
#21
2)
Could you explain what exactly is wrong with the original code apart from how you prefer it. I can see that it 'looks' better but it doesnt cause any bug.
Tracer

This has nothing to do with my preferences; I've forgotten the name but there is a design pattern around the while loop that describes this problem

You can write a simple 10-15 line C++ program that reads a text file and printfs on screen using both while loop structures.

This page also contains
http://www.codeproject.com/Articles/455228/Design-Patterns-of-Behavioral-Design-Patterns
 

TracerBullet

Well-Known Member
#22
@Tracerbullet,

There is nothing wrong with your code. All data from RTD server is received.
It comes sequentially in pairs like this.
topic_id - ltp, topic_id - ltt, topic_id - volume_traded_today, topic_id - oi
These are accumulated into mydata structure.
I created a condition to push mydata into array at the change of topic_id. Something is going wrong there.

This is the loop.
josh, fix the EnterCriticalSection and LeaveCriticalSection in processRTDData(). All array1 (and so also mydata stuff) should be within it.

Otherwise the two threads may mess up the data if they access at same time. After that, if its still not working, you will have to debug in Visual Studio by setting breakpoint and then inspect the data to understand the problem. If you havent already, learn debugging - will help a lot to find bugs.

Tracer

This has nothing to do with my preferences; I've forgotten the name but there is a design pattern around the while loop that describes this problem

You can write a simple 10-15 line C++ program that reads a text file and printfs on screen using both while loop structures.

This page also contains
http://www.codeproject.com/Articles/455228/Design-Patterns-of-Behavioral-Design-Patterns
Are boss, current loop may perhaps be more prone to bugs if changed incorrectly - what you wrote is generally more perferable.

But this is minor stuff and its currently correct, i dont see any bug in it. So no need to change it. This code is already tested long time back with debugging, no need for printfs. Do you see a bug in reading settings?
 

mastermind007

Well-Known Member
#23
josh, fix the EnterCriticalSection and LeaveCriticalSection in processRTDData(). All array1 (and so also mydata stuff) should be within it.

Otherwise the two threads may mess up the data if they access at same time. After that, if its still not working, you will have to debug in Visual Studio by setting breakpoint and then inspect the data to understand the problem. If you havent already, learn debugging - will help a lot to find bugs.



Are boss, current loop may perhaps be more prone to bugs if changed incorrectly - what you wrote is generally more perferable.

But this is minor stuff and its currently correct, I don't see any bug in it. So no need to change it. This code is already tested long time back with debugging, no need for printfs. Do you see a bug in reading settings?
I have never used this software for my own live feed. Not even installed it. Josh1 mentioned that it was not reading the last scrip in the post # 8 and I had quoted that in my reply to him.

Josh started this thread because he wanted other C++ programmers involved. If you are going to simply resist without even verifying, it will be of no use for me to waste my time here.

I have been programming for 18+ years and I never ever write any code for my preferences. Computer always does what you tell it to do, not what you want it to do.
 
Last edited:

josh1

Well-Known Member
#24
Are boss, current loop may perhaps be more prone to bugs if changed incorrectly - what you wrote is generally more perferable.

But this is minor stuff and its currently correct, i dont see any bug in it. So no need to change it. This code is already tested long time back with debugging, no need for printfs. Do you see a bug in reading settings?
I have never used this software for my own live feed. Not even installed it. Josh1 mentioned that it was not reading the last scrip in the post # 8 and I had quoted that in my reply to him.

Josh started this thread because he wanted other C++ programmers involved. If you are going to simply resist without even verifying, it will be of no use for me to waste my time here.

I have been programming for 18+ years and I never ever write any code for my preferences. Computer always does what you tell it to do, not what you want it to do.
Guys,

Please don't make this prestige issue.

I have found out where the problem is. I shall revert with specifics.
 

TracerBullet

Well-Known Member
#25
I have never used this software for my own live feed. Not even installed it. Josh1 mentioned that it was not reading the last scrip in the post # 8 and I had quoted that in my reply to him.

Josh started this thread because he wanted other C++ programmers involved. If you are going to simply resist without even verifying, it will be of no use for me to waste my time here.

I have been programming for 18+ years and I never ever write any code for my preferences. Computer always does what you tell it to do, not what you want it to do.
i ask a simple question on why its a bug, you take it personally. I understood what you said but i dont see it as a bug and its not related to josh's issue. If there is a usecase where it fails, we will be glad to know. You cant expect me to read a book on design patterns.
Anyway here is a decent q&a on it.

Also, the code is more or less final now from me so there is no resistance, i wont change and anyone is free to change/discard.

Anyway, Dont mind me. i dont claim to be a great programmer - so dont take it as a prestige/fight thing. And this is not even a programming forum ....
 

mastermind007

Well-Known Member
#26
TracerBullet


Before I leave this thread for good, let me remind you what you've said so that you can re-decide for yourself who has taken what personally.
1) "Are boss, current loop may perhaps be more prone to bugs if changed incorrectly - what you wrote is generally more perferable."in Post numbered 23

2) "Could you explain what exactly is wrong with the original code apart from how you prefer it. I can see that it 'looks' better but it doesnt cause any bug." in Post numbered 20

3) i ask a simple question on why its a bug, you take it personally. I understood what you said but i dont see it as a bug and its not related to josh's issue. If there is a usecase where it fails, we will be glad to know. You cant expect me to read a book on design patterns. in post numbered 26


Kindly Pay particular attention to the words and the quotation marks used you and now highlighted by me for your viewing pleasure.

Now as far as the error goes, Josh1 reported it as a problem in post numbered 8 and to me, it instantly seemed like something that I could resolve by merely reading through the code and that is what I attempted to do. For rest of the problems, I will need data and a working installation to step-debug through the code.

For some reason, you missed that Josh1's post so I again pointed it out to you to which you started speculating of newer suggested code being "more prone to bugs"

Even after I denied that it had anything to with my preferences, you've continued on the same pitch and therefore I've termed that as resistance (merely for sake of resisting) and I repeat that.

So, yes, I apologize to you in particular and to everyone for having attempted to help here.


You can continue with your path of keep blaming users for having wrong settings.ini.... You already have the justification that you are not a "great programmer" so you can continue nursing the bugs in the code by denying their existence.

PS: I've glanced thru the stack exchange page you had sent and there is one very big difference between the example on that page and in the RTDMan's code related to reading the settings.ini file. The terminating condition in his imaginary example seems to have been derived from the processing of input whereas ours is derived from the end of Input.

Thankfully, he too shows and mentions the breaking while loop from middle as bad code. His arguments such as having to change function name at two places are pedantic given the modern era programming editors and refactoring tools at our disposal.
 
Last edited:

TracerBullet

Well-Known Member
#27
Inline
TracerBullet

Before I leave this thread for good, let me remind you what you've said so that you can re-decide for yourself who has taken what personally.
1) "Are boss, current loop may perhaps be more prone to bugs if changed incorrectly - what you wrote is generally more perferable."in Post numbered 23

[TB] And so what? This is not code review, you are not a GL. In its current state, that code does not (seems to) have any bug and we dont have need to pretty up a short term project. Whether the alternative is best way is arguable.

2) "Could you explain what exactly is wrong with the original code apart from how you prefer it. I can see that it 'looks' better but it doesnt cause any bug." in Post numbered 20

[TB] yes, so did you reply wheres the bug?

3) i ask a simple question on why its a bug, you take it personally. I understood what you said but i dont see it as a bug and its not related to josh's issue. If there is a usecase where it fails, we will be glad to know. You cant expect me to read a book on design patterns. in post numbered 26


Kindly Pay particular attention to the words and the quotation marks used you and now highlighted by me for your viewing pleasure.
[TB]
But You start saying how much experience you have and that you dont even use this tool - neither of which is relevant. All i ask is to understand how its a bug? So whos getting personal? :)


Now as far as the error goes, Josh1 reported it as a problem in post numbered 8 and to me, it instantly seemed like something that I could resolve by merely reading through the code and that is what I attempted to do. For rest of the problems, I will need data and a working installation to step-debug through the code.

[TB]
Yes, thanks for helping. Its very hard to fix an unclear bug without debugging. Even harder to look at new code written by someone else ( me / him) without detailed documentation / comments.
But What you suggested was not relevant for his issue and that is what i pointed out. I am not trying to one up anyone here.
[/B]


For some reason, you missed that Josh1's post so I again pointed it out to you to which you started speculating of newer suggested code being "more prone to bugs"
[TB]
I didnt miss his post, and i didnt say his new code is more prone to bugs - read again.[/B]


Even after I denied that it had anything to with my preferences, you've continued on the same pitch and therefore I've termed that as resistance (merely for sake of resisting) and I repeat that.

So, yes, I apologize to you in particular and to everyone for having attempted to help here.


[TB] No need for drama - forget about preferences, since you continue to empahize about the loop thing - just describe how its a bug - maybe i missed something. [/B]

You can continue with your path of keep blaming users for having wrong settings.ini.... You already have the justification that you are not a "great programmer" so you can continue nursing the bugs in the code and keep denying the bug's existence.
[TB]
Hahaha, where did i say that ( blaming users) - read my posts again. Again i assert that what you pointed out is not a bug - you have not once explained clearly how its a bug .
Great is relative - i say kernel programmers, game developers are great. i say scientists who develop the actual algos that us lowly programmers use are great.
Instead of continuing a useless discussion, we can help josh on his problem. But hopefully, its already solved.
[/B]


PS: I've glanced thru the stack exchange page you had sent and there is one very big difference between the example on that page and on the RTDMan's code. The terminating condition in his imaginary example seems to have been derived from the processing of input whereas ours is derived from the end of Input.

Thankfully, he too shows and mentions the breaking while loop from middle as bad code. His arguments such as having to change function name at two places are pedantic given the modern era programming editors and refactoring tools at our disposal.

[TB]
Good/Bad - But how does that cause a bug. Bad code is arguable as they said, for trival code these things dont matter. Modern tools not withstanding, people will make mistakes either way.
[/B]
There is no point in continuing this silly discussion, you didnt provide 1 single use case where current loop code fails. Arguing over such insignifcant things is laughable.

Anyway, this is unneeded debate that doesnt help josh - Please continue helping him if you desire and i wont get into it unless asked for. Thanks
 

copypasteaee

Humbled by Markets
#28
My two cents: If you keep the base interval of database as 5minutes and feed it with lower Time frame feed(1 minute or i second may be), then amibroker automatically finds the OHLC of base TF i.e 5 mins in case of this example. There should not be any need of finding OHLC of 1 minute bar by the data feed SW.

I may be completely wrong, so ignore my comments if some one finds them wrong.
 

josh1

Well-Known Member
#29
Finally, I solved the issue. RTDMan is creating 1 min bars or 1 sec. bars optionally according to Bar_Period in settings.ini. Today, I ran it for two hours and there is no data loss. I could watch it following data from terminal immediately within a second as it was displayed. I had 27 scrips in my watch list. Maximum volume of more than 1.5 cr. in NIFTY15JUL8500CE and it was easily captured. Resulting exe is lesser in size at 89kb.

However, I am not able to change the version. Original version is 0.1.4_2. I have created folder C:\RTDMan_0.1.4_2 and extracted all the original files of Tracerbullet in it. I can modify individual cpp and header files in it. How do I change version no. to 1.5 ?

If I create another folder say C:\RTDMan_0.1.5 and copy all contents there, VC++ does not compile it properly. Gives me an exe of 450kb. :annoyed::mad:
 

TracerBullet

Well-Known Member
#30
Finally, I solved the issue. RTDMan is creating 1 min bars or 1 sec. bars optionally according to Bar_Period in settings.ini. Today, I ran it for two hours and there is no data loss. I could watch it following data from terminal immediately within a second as it was displayed. I had 27 scrips in my watch list. Maximum volume of more than 1.5 cr. in NIFTY15JUL8500CE and it was easily captured. Resulting exe is lesser in size at 89kb.

However, I am not able to change the version. Original version is 0.1.4_2. I have created folder C:\RTDMan_0.1.4_2 and extracted all the original files of Tracerbullet in it. I can modify individual cpp and header files in it. How do I change version no. to 1.5 ?

If I create another folder say C:\RTDMan_0.1.5 and copy all contents there, VC++ does not compile it properly. Gives me an exe of 450kb. :annoyed::mad:
Good, i did Versioning with git ( which keeps track of code changes in files).
Git is cool and also has GUI, it may have VS plugins but i didnt use them as it has simple command interface for basic usage. It can be used to track versions of any project.

Visual studio project folder does not need to change - i keep it in AmibrokerFeeder\RTDMan.

git helps when multiple people work together on common code, although i have not used it as such as we had different stuff in my old workplace.
If you dont want to deal with git, you can simply copy the output and rename folder. But if there is any plan for more stuff, esp with multiple people, maybe learn it when free ( esp will need to learn how branches work - i am not familiar either).

btw i did some minor changes too + added option to ring bell when rtd becomes inactive - ZT stops it many times these days.
 

Similar threads