Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 80

 

Good afternoon. Can you help/explain to me please?

I have for example a trawl

its value is static

i need to use an array and no other way to make its value dynamic

for example this is how I see it

int tral[t] {10,9,8,7,6,5,4,3,2,1}

int profit[p] {3,6,9,12,15,18,21,24,27,30}

i need for example if profit is more than 3 the value is 10, more than 6 the value is 9. and so on through the arrays

write or throw if there is an example ... thanks in advance

 
sannin:

Good afternoon. Can you help/explain to me please?

I have for example a trawl

...

Check out the Library of Functions and Expert Advisors for trailing stops / Yuri Dzyuban about trailing stops. What you wrote is similar to "4. Trailing a standard 'booby trap'". Maybe something will come in handy.
 

How are you going to match the values in the arrays with the profit value? How will you index the arrays if the order profit value does not coincide with the profit value written in the array?

Let me explain: if the order profit value == 3, we should look for value 3 in profit[] in the array and memorize the index pointing to the array cell with value 3. Then we use this index to read the value shown in the tral[] array and assign the read value to the trawl size. It would be better to create a two-dimensional array for this purpose so that we do not have to search through different arrays.

BUT. when profit value == 4 or 5, there are no such values in the array and we cannot do without simple indexing here

 
paladin80:
Check out the Library of Functions and Expert Advisors for Trailing / Yuri Dzyuban about trailing stops. What you wrote is similar to "4. Trailing a Standard Trailing Stops". Maybe something will come in handy.

thanks for the library...but i'm interested in the array
 
artmedia70:

How are you going to match the values in the arrays with the profit value? How will you index the arrays if the order profit value does not coincide with the profit value written in the array?

Let me explain: if the order profit value == 3, we should search for value 3 in profit[] in the array and memorize the index pointing to the array cell with value 3. Then we use this index to read the value shown in the tral[] array and assign the read value to the trawl size. It would be better to create a two-dimensional array for this purpose so that we do not have to search through different arrays.

BUT. when profit value == 4 or 5, there are no such values in the array and we cannot do without simple indexing here


Yes, you're probably right, if it's not too much trouble, could you please implement it in the code
 
sannin:

You're right, if it's not too much trouble, you may want to implement it in your code.

I could, but it would be a disservice. This thread helps those who write their own code, but it doesn't work. You have not yet shown your code, which does not work or does not work.

But it's free...

 
artmedia70:

I could, but it would be a disservice. This thread helps those who write their own code, but it doesn't work. You haven't shown us your code, which doesn't work or can't work.

But it's a freebie...



I mean, it's not going to be free. Although I do occasionally do that.
 

The reality is that the challenge is much more global than that.

I gave a simple example

if the number of a variable is the same as the number in the array (e.g. array 1 number 2 in the fifth position)

then from another array, search for position five and assign the number from that position to variable 2 (e.g. array 2 position 5 number 35)

where can i just see how to write this?

the textbook's a little sketchy.

the topic is called any beginner's question

and the newest me with such smart eyes is still to be found

 

I want to make it so that if the closing price of 1 candle is above the green (or below the red) line of the Supertrend indicator, then perform actions. What happens is the following. When the price is above the green line, the firmware understands "Above the green and above the red". If it is below the green line, it understands "Below the green and below the red". And the same for the red line. Please help me, what should I do to make an indicator understand colours differently?

Here is the code I used.

int start()
  {
//----
   double super_green = iCustom(NULL,0,"Supertrend",0,1);
   double super_red =   iCustom(NULL,0,"Supertrend",1,1);
 
   if(Close[1]>super_green)     
    Alert("Цена выше зеленой");     
    
   if(Close[1]<super_red) 
    Alert("Цена ниже красной");   
     
//----
   return(0);
  }

After that it outputs this.

 
webip:

I want to make it so that if the closing price of 1 candle is above the green (or below the red) line of the Supertrend indicator, then perform the action. What happens is the following. When the price is above the green line, the firmware understands "Above the green and above the red". If it is below the green line, it understands "Below the green and below the red". And the same for the red line. Please help me, what should I do to make an indicator understand colours differently?

Here is the code I used.

After it gives out this.


IOW ...

if((ObjectGet("trendlogo1",OBJPROP_COLOR)==Green && ObjectGet("trendlogo2",OBJPROP_COLOR)==Green) ||

(ObjectGet("trendlogo1",OBJPROP_COLOR)==Lime && ObjectGet("trendlogo2",OBJPROP_COLOR)==Lime))

buy=1;

THE ANSWER IS CLEAR FROM THIS EXAMPLE
Reason: