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

 
sannin:

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

int tral[10]   = {10,9,8,7,6,5,4,3,2,1};
int profit[10] = {3,6,9,12,15,18,21,24,27,30};
int ProfitPips;
int TrallPips;
//---
ProfitPips=15;
for (int i=0; i<=9; i++)
{  if (ProfitPips!=profit[i]) continue;
   else 
   {  TrallPips=tral[i];
      break;
   }
}
// TrallPips=6
 

So you take the profit from the order and compare it with the profit array, as you guess the same element number you take from the trawl array and put a stop.

Take a ready-made trawl and modify it.

 

Greetings.

Help me to understand how to correctly calculate the lot of a trade, if I know the amount at which the order needs to close and the number of pips to be passed.

For example:

I want to close an order when it has passed 60 pips and thus will earn 270 USD.

At which lot should I open?

How do I explain this to the Expert Advisor?

 
paladin80:

THANK YOU SO MUCH! A LOT!!! A LOT!!! THANK YOU!!!
 
belck:

Greetings.

Help me to understand how to correctly calculate the lot of a trade, if I know the amount at which the order needs to close and the number of pips to be passed.

For example:

I want to close an order when it has passed 60 pips and thus will earn 270 USD.

At which lot should I open?

How do I explain this to the Expert Advisor? What is the formula?


Look at how you can make 60 BACKS by passing 60 points LOT 01

120 LOT 02

180 LOT 03

240 -04

300 - 05

I.E. LOT = AMOUNT OF MONEY (YOU KNOW IT FROM SOMEWHERE ELSE) / NUMBER OF POINTS 270/60 = 5*0.1

IT MEANS WHEN PLACING ORDER SEND AND EVERY SUCH LOT AND SO ON BY THE BOOK

 
splxgf:

So you take the profit from the order and compare it with the profit array, as you guess the same element number you take from the trawl array and put a stop.

Take a ready-made trawl and modify it.


I want exclusive

 
sannin:


see how you make 60 Bacs by moving 60 pips LOT 01

120 LOT 02

180 LOT 03

240 -04

300 - 05

LOT = AMOUNT OF MONEY (YOU KNOW IT FROM SOMEWHERE) / NUMBER OF POINTS 270/60 = 5*0.1

THAT MEANS WHEN PLACING ORDER SEND AND EVERYTHING ELSE IS A LOT AND SO ON BY THE BOOK.


I did. Thank you.
 

extern double Lot=0.1;

extern int punktov=10;

if you mean a infinite number of digits, then pay attention to the fact, that the variable has to be a double, so that the lot would be 0,123 for example.

 
splxgf:

So you take the profit from the order and compare it with the profit array, as you guess the same element number you take from the trawl array and put a stop.

Take a ready-made trawl and modify it.


in what way
 
sannin:


I want an exclusive


As you modify it, it will be exclusive... Your code is not bad, but you need a smaller comparison operation, but it seems to be viable.