Click here to Skip to main content
15,887,746 members
Home / Discussions / C#
   

C#

 
GeneralRe: Data in XmlFiles or in Database Pin
Jasmine25016-May-13 8:26
Jasmine25016-May-13 8:26 
GeneralRe: Data in XmlFiles or in Database Pin
jschell7-May-13 9:27
jschell7-May-13 9:27 
AnswerRe: Data in XmlFiles or in Database Pin
RedDk26-Apr-13 11:54
RedDk26-Apr-13 11:54 
GeneralRe: Data in XmlFiles or in Database Pin
Eddy Vluggen26-Apr-13 22:36
professionalEddy Vluggen26-Apr-13 22:36 
AnswerRe: Data in XmlFiles or in Database Pin
Eddy Vluggen26-Apr-13 23:32
professionalEddy Vluggen26-Apr-13 23:32 
GeneralRe: Data in XmlFiles or in Database Pin
Frygreen27-Apr-13 0:31
Frygreen27-Apr-13 0:31 
AnswerRe: Data in XmlFiles or in Database Pin
PIEBALDconsult27-Apr-13 12:31
mvePIEBALDconsult27-Apr-13 12:31 
QuestionRunning a loop, try to get both [i] value (todayvalue), and [i - 1] value (yesterdays value) Pin
lordoftrades25-Apr-13 0:47
lordoftrades25-Apr-13 0:47 
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....

C#
if (0 <= mov10value - mov50value  &&  0 <= mov20value - mov50value)
            //if ((mov10valueY - mov50valueY <= 0) && (mov20valueY - mov50valueY <= 0))
            {
                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

AnswerOT Pin
Keith Barrow25-Apr-13 2:56
professionalKeith Barrow25-Apr-13 2:56 
GeneralRe: OT Pin
lordoftrades25-Apr-13 3:37
lordoftrades25-Apr-13 3:37 
GeneralRe: OT Pin
Keith Barrow25-Apr-13 6:26
professionalKeith Barrow25-Apr-13 6:26 
GeneralRe: OT Pin
lordoftrades25-Apr-13 20:29
lordoftrades25-Apr-13 20:29 
QuestionExRichTextBox Pin
Star.jon24-Apr-13 21:45
Star.jon24-Apr-13 21:45 
AnswerRe: ExRichTextBox Pin
Marco Bertschi24-Apr-13 22:10
protectorMarco Bertschi24-Apr-13 22:10 
GeneralRe: ExRichTextBox Pin
Star.jon25-Apr-13 20:32
Star.jon25-Apr-13 20:32 
GeneralRe: ExRichTextBox Pin
Star.jon25-Apr-13 20:35
Star.jon25-Apr-13 20:35 
GeneralRe: ExRichTextBox Pin
Marco Bertschi25-Apr-13 21:49
protectorMarco Bertschi25-Apr-13 21:49 
Questionhow to detect SoundEffect stoped in xna Pin
payjo24-Apr-13 15:15
payjo24-Apr-13 15:15 
Questionsetup error in c# Pin
User349024-Apr-13 4:11
User349024-Apr-13 4:11 
AnswerRe: setup error in c# Pin
Keith Barrow24-Apr-13 5:05
professionalKeith Barrow24-Apr-13 5:05 
QuestionCallBack to consumer using RESTful / MVC / WCF Pin
jexes23-Apr-13 22:51
jexes23-Apr-13 22:51 
QuestionProgramming a Symbol Handheld Scanner Pin
bob18123-Apr-13 20:57
professionalbob18123-Apr-13 20:57 
AnswerRe: Programming a Symbol Handheld Scanner Pin
Pete O'Hanlon23-Apr-13 21:29
mvePete O'Hanlon23-Apr-13 21:29 
AnswerRe: Programming a Symbol Handheld Scanner Pin
Joe Woodbury24-Apr-13 8:19
professionalJoe Woodbury24-Apr-13 8:19 
Questionprinting students grades after finding them in files.. Pin
Magda634723-Apr-13 9:30
Magda634723-Apr-13 9:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.