[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 211

 

From the tutorial:

It is possible to pass parameters by reference. In this case, the modification of such parameters will affect the corresponding variables in the called function passed by reference. It is not possible to pass elements of arrays by reference. Parameters can be passed by reference only within a single module.

What do you mean by the word "module"?

 
I think what is meant here by module is a single programme.
The costs of VB experience, however.
 

Afternoon.

I've written scripts to open orders and simultaneously place a Protection in the form of a pending order.

Here is the code for SELL.

//+------------------------------------------------------------------+

//| OpenSELL_Lok.mq4 |

//| KarkadilGENA |

//| http://forum.fibo-forex.ru/ |

//+------------------------------------------------------------------+

#property copyright "KarkadilGENA"

#property link "http://forum.fibo-forex.ru/"


#property show_inputs

//--------------------------------------------------------------------


extern double MARTIN = 1; // lot increment ratio (knees count)

extern int stoploss = 20, //level of SL, if 0, SL is not exhibited

takeprofit = 40, //t TP level, if 0, TP is not set.

Magic = 345; //unique number of the order

extern double Lot = 0.01; //order volume

//+------------------------------------------------------------------+

int start()

{

//----

double lots, SL, TP;

int ticket.sell=-1;

while(ticket.sell<0)

{

RefreshRates();

Lot=NormalizeDouble(Lot,2);

lots = Lot * MARTIN;

TP = NormalizeDouble(Bid - takeprofit*Point,Digits);

ticket.sell=OrderSend(Symbol(),OP_SELL,lots,Bid,3,0,TP,NULL,Magic,0,CLR_NONE);

if(ticket.sell<0)

Alert ("Error on position opening ");

return;

}

int ticket_BUYSTOP=-1;

while(ticket_BUYSTOP<0)

{

RefreshRates();

Lot=NormalizeDouble(Lot,2);

lots = Lot * MARTIN;

SL = NormalizeDouble(Bid + stoploss*Point,Digits);

ticket_BUYSTOP=OrderSend(Symbol(),OP_BUYSTOP,lots,SL,3,0,0,NULL,Magic,0,CLR_NONE);

if(ticket_BUYSTOP<0)

Alert ("Failed to open position ");

return;

}

return(0);

}

//+------------------------------------------------------------------+

The first opening proceeds normally, but on the second ( with existing positions open ),

Two protections are opened. Both Stop and Limit. In my code it is written Only One, Stop.

When I open a third one, it opens several Protection orders.

Please tell me how to make OWL open one protection , regardless of number of already open positions.

Thanks.

 

Thank you for your reply yesterday.

How do I get the current price?

 

Afternoon.

I have an EA taking a value from an indicator where a line connects two upper or lower fractals.

How can I get (or build) these lines in the EA itself so that I don't have to refer to the indicator ?

 
AndEv:

From the tutorial:

It is possible to pass parameters by reference. In this case, the modification of such parameters will affect the corresponding variables in the called function passed by reference. It is not possible to pass elements of arrays by reference. Parameters can be passed by reference only within a single module.

What do you mean by the word "module"?

Meaning that, for example, the ex4-library cannot
 
Stells:

Afternoon.

I have an EA taking a value from an indicator where a line connects two upper or lower fractals.

How can I get (or build) these lines in the EA itself so that I don't have to refer to the indicator ?


You can use the formulae of the lines from the indicator + in the EA you draw these lines with objects.
 
Roman.:

You write the formulas for the lines with the indicator + draw these lines as objects in the board.
I made an indicator, which takes values for buffers from global variables. And the values themselves are sent from the EA together with colour and drawing style.
 

Hello, there is a function that signals to buy or sell. If you set it simply

If(sig1) SetOrder(....) ;

Then it opens many times.

Attention question!) How to make it open once for(sig1) it can be so sig1-open BAY, next command, sig0-admit trawl is on (whatever), next command again, sig1-open second BAY.

 
It is possible to remember the previous value of sig1and only open an order when the previous value was prohibitive when the current value was permissive.