vendredi 6 mars 2015

passing a result(double type variable) from a method as an element of an array

Background - I am new to programming in C# and am trying to code a custom indicator. On a trading platform that uses C#. A histogram with positive Y axis = reqAskArraySum negative Y axis = reqBidArraySum The inbuilt compiler shows no errors. However the desired results do not seem to show up. I know/it is possible there are some platform specific initialization problems i.e. code that I have not entered yet correctly.


Question - The question here is with regards to the code posted below , which is a part of the whole code. I would like to know whether the posted code satisfies the below objectives.



  1. The objective here is to get a 'number' using a method.

  2. Then only accept selected 'numbers' into an array. The selection/filtration is done by an 'If' statement


Any help and pointers would be highly appreciated.


`enter code here'



int i=0;
double iAskSize = GetLevel2Size(ASK,0); **//GetLevel2Size(ASK,0) is the method that helps me to retrieve the ASK side 'numbers'//****
double iBidSize = GetLevel2Size(BID,0); **//GetLevel2Size(BID,0) is the method that helps me to retrieve the BID side 'numbers' //**


if(iAskSize>=AskTH_value) **//the number should be >= user defined AskTH_value, this is the filtration of the Ask Side 'numbers'//**


//I am trying to get the filtered iAskSize 'numbers' into the array reqAskSize, I believe there is a problem here. However I am not sure //



{
double[] reqAskSize = new double[1000];

double reqAskArraySum = 0;

for(i=0;i<reqAskSize.Length;i++)
{
reqAskArraySum = reqAskArraySum + reqAskSize[i];
}

SetValue(0,reqAskArraySum);

}



if(iBidSize>=BidTH_value) **//the number should be >= user defined BidTH_value,this is the filtration of the Bid Side 'numbers'//**


//I am trying to get the filtered iBidSize 'numbers' into the array reqBidSize, I believe there is a problem here. However I am not sure //



{
double[] reqBidSize = new double[1000];

double reqBidArraySum = 0;

for(i=0;i<reqBidSize.Length;i++)
{
reqBidArraySum = reqBidArraySum + reqBidSize[i];
}

SetValue(1,-reqBidArraySum);
}

Aucun commentaire:

Enregistrer un commentaire