|
Stop it, you're making yourself look bad. The joke is obvious, I even bolded it.
|
|
|
|
|
Jasmine2501 wrote: Stop it, you're making yourself look bad
You are making assumptions about me.
Jasmine2501 wrote: The joke is obvious, I even bolded it.
As I already said - I was responding to your entire post. And as I said, it was wrong.
|
|
|
|
|
jschell wrote: As I already said - I was responding to your entire post. And as I said, it was wrong.
No it's not. There is nothing wrong about my post. Everything I said was 100% true, and backed by 25 years of experience in this industry. There was a joke about horrible spelling in there, and that wasn't wrong or right, it was funny if you got it, which you didn't. The fact that you responded to that was funny for a minute but now it's just lame.
http://dictionary.reference.com/browse/loose?s=t[^]
http://dictionary.reference.com/browse/lose?s=t[^]
Get it now?
|
|
|
|
|
Jasmine2501 wrote: Everything I said was 100% true,
My original post explained why it was wrong. If you didn't understand that you should have asked.
Jasmine2501 wrote: and backed by 25 years of experience in this industry
I have that beat.
Jasmine2501 wrote: it was funny if you got it, which you didn't.
And you obviously keep ignoring that I was responding to you entire post despite me stating it explicitly multiple times. Your continued restatement that you were attempting to be funny will not change that nor does it alter what I said.
|
|
|
|
|
I said "features are never loose with a database, they are always tight" which was a joke on the mistaking of "loose" for "lose" and you responded as if it was a serious statement. That was your mistake, and this lame attempt to defend yourself is only pointing out the fact that you missed the joke. Now stop it, you're embarrassing yourself.
Secondly, even if your response was not about the part you quoted, but also about the rest of what I said, that particular response didn't make a whole lot of sense and I disagree with it, based on my many years of experience in the real business world, which is more like 30 years, but it isn't a competition. I have enough experience to know that what I said is absolutely true almost anywhere you go and if you disagree with it, that's fine, I will leave it to the readers to decide for themselves.
|
|
|
|
|
Jasmine2501 wrote: I said "features are never loose with a database, they are always tight" which was a joke on the mistaking of "loose" for "lose" and you responded as if it was a serious statement. That was your mistake, and this lame attempt to defend yourself is only pointing out the fact that you missed the joke. Now stop it, you're embarrassing yourself.
I suggest you re-read the sub thread. Pay particular attention to where I told you repeatedly that I was responding to your entire post.
Jasmine2501 wrote: based on my many years of experience in the real business world,
Since it isn't possible to instantaneously update all clients I can't imagine what business experience you have had.
|
|
|
|
|
jschell wrote: I suggest you re-read the sub thread. Pay particular attention to where I told you repeatedly that I was responding to your entire post.
I already addressed that problem.
jschell wrote: Since it isn't possible to instantaneously update all clients I can't imagine what business experience you have had.
I did not say it was.
This is really annoying. If you're trying to annoy me, it's working. If you're trying to disprove something I said, that's not working.
|
|
|
|
|
Jasmine2501 wrote: If you're trying to annoy me, it's working
I am pointing out an incorrect statement. Your emotional state has nothing to do with it.
Jasmine2501 wrote: If you're trying to disprove something I said, that's not working.
I don't need to disprove it since you already agreed that one can't update all clients immediately.
Not with an xml file and not with a database. You claime the former and ignored the latter.
|
|
|
|
|
jschell wrote: I am pointing out an incorrect statement. Your emotional state has nothing to do with it.
It is absolutely correct and you are wrong, and that is absolutely annoying and it would be to anyone. Seriously, let it go dude, nobody cares any more.
|
|
|
|
|
Jasmine2501 wrote: It is absolutely correct and you are wrong
You are wrong.
Jasmine2501 wrote: and that is absolutely annoying and it would be to anyone
Again that is an emotional context which doesn't interest me and has nothing to do with the technical merits.
Jasmine2501 wrote: Seriously, let it go dude, nobody cares any more.
And yet you keep responding and keep claiming that I am wrong.
|
|
|
|
|
Strictly from the database side of the equation I'd vouch for the use of xml stored in the database as xml almost solely on the ease of using one table to stack all the individual "xml" up. It's sort of a side-effect that turns out to be exceedingly useful.
Isn't this the reason there are TABLE in SQL? And not FILE?
modified 27-Apr-13 16:24pm.
|
|
|
|
|
RedDK wrote: Isn't this the reason there are TABLE in SQL? And not FILE?
In Paradox, those concepts were the same.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Frygreen wrote: One advantage of xml is, that files can be easily moved around via simple copy/paste. Do I loose this feature with a database?
Depends what database-system you'll be choosing. For local data, I prefer SQLite (over SqlCE) as it's available on both Windows and Linux. One can XCopy such a file-database if no-one is using it at that particular moment.
SqlExpress or MySQL would be recommended if your user wanted to share his/her data.
A huge advantage of using a database over a custom structure is the fact that a database has been built for the explicit reason of storing data, and has been optimized over years to do so. It'd be faster, more secure, and it'd cut the dependency to the custom structure (iow, it'd be "standardizing" on Sql).
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
For the moment: Thanks for all of these replies. This dicussion is exactly what I'm looking for
|
|
|
|
|
Sql Server CE may be a good in-between solution. Or even Excel which can be accessed like a database via ADO.net / OleDb / Jet/ACE
But I second the concern about each user having his own copy rather than a centralized database. It will bite you.
|
|
|
|
|
Hi
I have a loop where I try to pull stockdata, i'm getting moving averages for each day in the loop.
The basic idea is to enter a trade if MA20 is crossing MA50, and MA10 is above MA50.
I've written this test in VBA in Excel, then it was easy to define yesterdays value, it todays value was set by i, yesterday was i - 1.
But in C# I don't know how to solve it, I've just started to write in this language....
if (0 <= mov10value - mov50value && 0 <= mov20value - mov50value)
{
BrokerMarket(IQ_ActionType.BUY, symbolIndex, 100, IQ_TIF.DAY, "Buy");
}
if (0 <= mov50value - mov20value && mov50value - mov20value <= 0.3 && PositionExists(IQ_TradeStatus.OPEN, symbolIndex))
{
int[] positionIndexes = PositionIndexList(IQ_TradeStatus.OPEN, symbolIndex);
double quantity = PositionQuantity(positionIndexes[0]);
BrokerMarket(IQ_ActionType.SELL, symbolIndex, quantity, IQ_TIF.DAY, "Sell");
}
Any help would be appreciated.
Kind regards
Espen
|
|
|
|
|
Hi Espen, first of something a bit OT:
if (0 <= mov10value - mov50value && 0 <= mov20value - mov50value)
I'd personally put the constant after the condition, some people do it (especially hardcore ex c++ devs), but the compiler will warn if you perform a potentially accidental assignment-->
if (mov10value - mov50value > 0 && mov20value - mov50value > 0)
This can be further simplified to:
if (mov10value > mov50value && mov20value > mov50value)
Which makes the conditional much easier to read, you'll need to check I've done what you needed. I'd stick an else before the second if as they seem to be mutually exclusive, if not ignore.
I'd rename the variables, to MovingAverage10, 50 etc. it'll make the code clearer to C# bodies, you'll get something like this:
if (MovingAverage10 > MovingAverage50 && MovingAverage20 > MovingAverage50)
{
BrokerMarket(IQ_ActionType.BUY, symbolIndex, 100, IQ_TIF.DAY, "Buy");
}
if ( MovingAverage50 > MovingAverage20 && MovingAverage50 - MovingAverage20 <= 0.3 && PositionExists(IQ_TradeStatus.OPEN, symbolIndex))
{
int[] positionIndexes = PositionIndexList(IQ_TradeStatus.OPEN, symbolIndex);
double quantity = PositionQuantity(positionIndexes[0]);
BrokerMarket(IQ_ActionType.SELL, symbolIndex, quantity, IQ_TIF.DAY, "Sell");
}
As for calculating the avergages, the -1 index should work, as long as you aren't on index 0 obviously.
Personally I'd avoid arrays unless I want to specify that I know the length of this list isn't going to change. I'd suggest a generic List<T> instead. Assuming you have are using .net 3.5 & we have the previous 100 days data in a List<double> called quantities, ending at today:
public static double GetMovingAverage(List<double> quantities, int daysToTake)
{
if (quantities.Count < daysToTake)
{
}
var qualifyingQuantities = quantities.Skip(quantities.Count - daysToTake).Take(daysToTake);
return quantities.Average();
}
Don't feel like I've answered you hope this helps.
“Education is not the piling on of learning, information, data, facts, skills, or abilities - that's training or instruction - but is rather making visible what is hidden as a seed” “One of the greatest problems of our time is that many are schooled but few are educated”
Sir Thomas More (1478 – 1535)
|
|
|
|
|
Thank you very much Keith, it cleared out quite some things for me, and I see that my logic sense has been totally lost some time.
I still have some questions on how to solve the case regarding the "yesterdays moving average".
Maybe this explains it better: I'm trying to detect when MA20 is crossing above MA50 (given that MA10 already is above). I need to know that MA20 was below MA50 yesterday to be sure that it has crossed as I'm not interested in the days when it stays above.
The MovingAverages are some sort preset scripts in a software that I use (IQBroker)
public void OnInitialize(int indicatorKey)
{
_MovingAverage10Keys = new int[SymbolCount()];
_MovingAverage20Keys = new int[SymbolCount()];
_MovingAverage50Keys = new int[SymbolCount()];
_indicatorKeys = new int[SymbolCount()];
for (int i = 0; i < SymbolCount(); i ++)
{
_indicatorKeys[i] = IndicatorCopy(indicatorKey, i);
_MovingAverage10Keys[i] = IndicatorSMA(_indicatorKeys[i], 10);
_MovingAverage20Keys[i] = IndicatorSMA(_indicatorKeys[i], 20);
_MovingAverage50Keys[i] = IndicatorSMA(_indicatorKeys[i], 50);
ChartIndicator(i, 0, IQ_YAxis.MERGE_RIGHT, _indicatorKeys[i], IQ_LineType.LINE, 1, IQ_Color.GREEN);
ChartIndicator(i, 0, IQ_YAxis.MERGE_RIGHT, _MovingAverage10Keys[i], IQ_LineType.LINE, 1, IQ_Color.RED);
ChartIndicator(i, 0, IQ_YAxis.MERGE_RIGHT, _MovingAverage20Keys[i], IQ_LineType.LINE, 1, IQ_Color.ORANGE);
ChartIndicator(i, 0, IQ_YAxis.MERGE_RIGHT, _MovingAverage50Keys[i], IQ_LineType.LINE, 1, IQ_Color.BLUE);
}
}
#endregion</pre>
Here's the If-part of the code:
{
double MovingAverage10 = IndicatorValue(_MovingAverage10Keys[symbolIndex]);
double MovingAverage20 = IndicatorValue(_MovingAverage20Keys[symbolIndex]);
double MovingAverage50 = IndicatorValue(_MovingAverage50Keys[symbolIndex]);
if (MovingAverage10 > MovingAverage50 && MovingAverage20 > MovingAverage50)
{
BrokerMarket(IQ_ActionType.BUY, symbolIndex, 10, IQ_TIF.DAY, "Buy");
}
if (MovingAverage20 < MovingAverage50 && MovingAverage50 - MovingAverage20 <= 0.8 && PositionExists(IQ_TradeStatus.OPEN, symbolIndex))
{
int[] positionIndexes = PositionIndexList(IQ_TradeStatus.OPEN, symbolIndex);
double quantity = PositionQuantity(positionIndexes[0]);
BrokerMarket(IQ_ActionType.SELL, symbolIndex, quantity, IQ_TIF.DAY, "Sell");
}
}
#endregion</pre>
I start to realize that the transition from VBA to C# is pretty tough
Kind regards
Espen
|
|
|
|
|
lordoftrades wrote: Maybe this explains it better: I'm trying to detect when MA20 is crossing above MA50 (given that MA10 already is above). I need to know that MA20 was below MA50 yesterday to be sure that it has crossed as I'm not interested in the days when it stays above.
Assuming you've calc'd the averages in psuedo code I'd do something like:
double MovingAverage10 = IndicatorValue(_MovingAverage10Keys[symbolIndex]);
double MovingAverage20 = IndicatorValue(_MovingAverage20Keys[symbolIndex]);
double MovingAverage50 = IndicatorValue(_MovingAverage50Keys[symbolIndex]);
double YesterdayMovingAverage10 = IndicatorValue(_MovingAverage10Keys[symbolIndex-1]);
double YesterdayMovingAverage20 = IndicatorValue(_MovingAverage20Keys[symbolIndex-1]);
double YesterdayMovingAverage50 = IndicatorValue(_MovingAverage50Keys[symbolIndex-1]);
public bool NeedToSell()
{
if(MovingAverage10 < MovingAverage50 || MovingAverage10 < MovingAverage20)
return false;
if (MovingAverage20 <= MovingAverage50)
return false;
return YesterdayMovingAverage20 < YesterdayMovingAverage50
}
lordoftrades wrote: I start to realize that the transition from VBA to C# is pretty tough
Darn tootin' I went the other way when I worked at the Uni, took me a while (well, to VB6) to wrap my head around it. The code you have looks quite procedural, my guess is it will simplify if you get the OO goodness right, but without knowing the problem domain it is hard to help.
“Education is not the piling on of learning, information, data, facts, skills, or abilities - that's training or instruction - but is rather making visible what is hidden as a seed” “One of the greatest problems of our time is that many are schooled but few are educated”
Sir Thomas More (1478 – 1535)
|
|
|
|
|
Good morning Keith
I see that the sum of our problems related to the transition to/from VB6 and C# could have been eliminated if we had playd the cards correct.
I got it to work now, than you very much for taking time to help me out.
I'm now ready to paint myself into a new corner
Have a nice day
Kind regards
Espen
|
|
|
|
|
I use ExRichTextBox picw access after the value of the negative? Why is that?
The Rtf result is:
{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fcharset0 Tahoma;}}
\viewkind4\uc1\pard\lang2052\f0\fs21{\pict\wmetafile8\picw-27521\pich502\picwgoal21552\pichgoal285
0100090000033ca00000000026a000000000050000000b0200000000050000000c02f6017f9426
a00000430f2000cc00000013009d0500000000f6017f9400000000280000009d05000013000000......
You can see the picw-27521 .Why?
|
|
|
|
|
Can you post the code behind it?
It seems like you get the raw RTF encoding instead of the RTF text.
|
|
|
|
|
StringBuilder _rtf = new StringBuilder();
int picw = (int)Math.Round((_image.Width / xDpi) * HMM_PER_INCH);
int pich = (int)Math.Round((_image.Height / yDpi) * HMM_PER_INCH);
int picwgoal = (int)Math.Round((_image.Width / xDpi) * TWIPS_PER_INCH);
int pichgoal = (int)Math.Round((_image.Height / yDpi) * TWIPS_PER_INCH);
_rtf.Append(@"{\pict\wmetafile8");
_rtf.Append(@"\picw");
_rtf.Append(picw);
_rtf.Append(@"\pich");
_rtf.Append(pich);
_rtf.Append(@"\picwgoal");
_rtf.Append(picwgoal);
_rtf.Append(@"\pichgoal");
_rtf.Append(pichgoal);
_rtf.Append(" ");
private const int MM_TEXT = 1;
private const int MM_LOMETRIC = 2;
private const int MM_HIMETRIC = 3;
private const int MM_LOENGLISH = 4;
private const int MM_HIENGLISH = 5;
private const int MM_TWIPS = 6;
private const int MM_ISOTROPIC = 7;
private const int MM_ANISOTROPIC = 8;
private const string FF_UNKNOWN = "UNKNOWN";
private const int HMM_PER_INCH = 2540;
private const int TWIPS_PER_INCH = 1440;
using (Graphics _graphics = this.CreateGraphics()) {
xDpi = _graphics.DpiX;
yDpi = _graphics.DpiY;
}
The above is code!
|
|
|
|
|
private const int MM_TEXT = 1;
private const int MM_LOMETRIC = 2;
private const int MM_HIMETRIC = 3;
private const int MM_LOENGLISH = 4;
private const int MM_HIENGLISH = 5;
private const int MM_TWIPS = 6;
private const int MM_ISOTROPIC = 7;
private const int MM_ANISOTROPIC = 8;
private const string FF_UNKNOWN = "UNKNOWN";
private const int HMM_PER_INCH = 2540;
private const int TWIPS_PER_INCH = 1440;
using (Graphics _graphics = this.CreateGraphics()) {
xDpi = _graphics.DpiX;
yDpi = _graphics.DpiY;
}
|
|
|
|
|
This is nice. But I can't see a RichTextBox anywhere in you code?
|
|
|
|
|