Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Three Line Break
 Post subject: Three Line Break Post rating: 0   New post Posted: Thu 14 Mar, 2013, 12:30 

User rating: 0
Joined: Sun 23 Sep, 2012, 20:58
Posts: 4
Location: United Kingdom, Bristol
Dear Support,

Please can you try to convert this mq4 code.

I am trying to convert this three line break .mq4 indicator (please see TLB.mq4 source code attached) and I am coming up with the following errors when compiling.

Image

Not knowing what I was doing I adjusted the ranges until it successfully compiled just to see if it would open on the chart... It did.

Not knowing how to correct this, I am hoping you may be able to help! The code below is the part causing the problem... I think.

I'd appreciate your help.

Many thanks

   int Mas[18];
   Mas[0] = 2037411651;  Mas[1] = 1751607666;  Mas[2] = 547954804;
   Mas[3] = 892350514;   Mas[4] = 3358007340;  Mas[5] = 4042453485;
   Mas[6] = 3991268595;  Mas[7] = 4062247922;  Mas[8] = 3840534000;
   Mas[9] = 669053157;   Mas[10] = 1953785888; Mas[11] = 791624304;
   Mas[12] = 779581303;  Mas[13] = 1684107892; Mas[14] = 1953722981;
   Mas[15] = 1936486255; Mas[16] = 892430382;  Mas[17] = 544567854;



Attachment:
File comment: Compile errors
tlb-compile-errors.jpg [93.14 KiB]
Downloaded 396 times


Attachment:
File comment: Three Line Break
TLB.mq4 [6.8 KiB]
Downloaded 268 times


 
 Post subject: Re: Three Line Break Post rating: 0   New post Posted: Thu 14 Mar, 2013, 12:50 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
You define the array type as int. But the values your are trying to store in the array is not fitting within the range of an integer variable.

Try to define the array as BigInteger. See https://docs.oracle.com/javase/1.5.0/doc ... teger.html for class details.


 
 Post subject: Re: Three Line Break Post rating: 0   New post Posted: Thu 14 Mar, 2013, 14:17 

User rating: 0
Joined: Sun 23 Sep, 2012, 20:58
Posts: 4
Location: United Kingdom, Bristol
Thanks for your advice.

I've read over the documentation unfortunately I keep going round in circles trying to correct the issue you highlighted. I'm learning as I go. I will persist...

However, any further assistance would be greatly appreciated!

Many thanks


 
 Post subject: Re: Three Line Break Post rating: 0   New post Posted: Fri 15 Mar, 2013, 11:20 

User rating: 0
Joined: Sun 23 Sep, 2012, 20:58
Posts: 4
Location: United Kingdom, Bristol
I'm stuck has anyone got any clue how to resolve this issue.

Cheers


 
 Post subject: Re: Three Line Break Post rating: 0   New post Posted: Fri 15 Mar, 2013, 11:28 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
The code does not work as you expect as well in mql, as the values that exceed the integer ranges get set to the max/min int values, try this as a script and check the outputs in Experts tab:

int start()
  {   
    int Mas[18];
   Mas[0] = 2037411651;  Mas[1] = 1751607666;  Mas[2] = 547954804;
   Mas[3] = 892350514;   Mas[4] = 3358007340;  Mas[5] = 4042453485;
   Mas[6] = 3991268595;  Mas[7] = 4062247922;  Mas[8] = 3840534000;
   Mas[9] = 669053157;   Mas[10] = 1953785888; Mas[11] = 791624304;
   Mas[12] = 779581303;  Mas[13] = 1684107892; Mas[14] = 1953722981;
   Mas[15] = 1936486255; Mas[16] = 892430382;  Mas[17] = 544567854;
   
   printArray(Mas);
   
   return(0);
  }

void printArray(int arr[], string comment=""){
   string str = "{";
   for (int i=0; i< ArraySize(arr); i++){
      str = str + arr[i] + ", ";
   }
   str = str + "}";
   Print(comment + ": " +str);
}

Hence you should start with fixing your mql code first.


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com