[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 577

 
Dimka-novitsek:

Good evening dtxth I open a buy order, just buy, in the price it says asc, just asc, and here, it swears like this 2012.02.19 22:31:57 2010.08.02 01:12 EURUSD order,M15: invalid price 1.30616000 for OrderSend function

Is this normal? Can I add normalization to it directly inside the order?


Normalisation can be prescribed right inside the Ordersand.
 

Good afternoon.

Can you tell me the code to build MA for MACD.

double iMA( string symbol, int timeframe, int period, int ma_shift, int ma_method, int applied_price, int shift)

applied_price should be equal to the MACD value.

 
Stells:

Good afternoon.

Can you tell me the code to build MA for MACD.

double iMA( string symbol, int timeframe, int period, int ma_shift, int ma_method, int applied_price, int shift)

applied_price should be equal to the MACD value.

It won't work...

That's because:

applied_price - Price used. Can be any of the price constants.


And price constants can take values:

The price used to calculate the indicators can take any of the following values:

Constant Value Description
PRICE_CLOSE 0 Closing price
PRICE_OPEN 1 Opening price
PRICE_HIGH 2 Maximum price
PRICE_LOW 3 Minimum price
PRICE_MEDIAN 4 Average price, (high+low)/2
PRICE_TYPICAL 5 Typical price, (high+low+close)/3
PRICE_WEIGHTED 6 Weighted closing price, (high+low+close+close)/4


So use

double iMAOnArray( double array[], int total, int period, int ma_shift, int ma_method, int shift)

Calculation of Moving Average on data stored in the array. Unlike iMA(...) the iMAOnArray function does not select data based on the instrument name, timeframe and price used - price data must be prepared in advance. The calculation is performed from left to right. To arrange access to the array elements as to time series (i.e., from right to left), use the ArraySetAsSeries function.
Parameters:
array[] - Array with data.
total - Number of elements to calculate. 0 means all elements of the array.
period - Averaging period for calculating a moving average.
ma_shift - Indicator shift relative to the price chart.
ma_method - Averaging method. Can be any of values of Moving Average methods.
shift - Index of the value obtained from the indicator buffer (shift relative to the current bar by a specified number of periods back).
 
Roman.:

Normalisation can be prescribed right inside the ordersend.


Thank you!!! I did. Now, I'm sorry, he does not seem to like the lot, he writes like this. 2012.02.20 08:16:41 2010.08.02 01:12 Tester: PrevBalance: 500.00, PrevPL: 0.00, PrevEquity 500.00, PrevMargin: 0.00, NewMargin: 653, FreeMargin: -153.05

This is a demo account. Is lot one a lot, sorry???? And what is the new margin, free margin?

Yes, that's it, a lot at a balance of 1000 walks.

 
Dimka-novitsek:


Thank you!!! I did so. Now, I'm sorry, he doesn't seem to like the lot, he writes like this. 2012.02.20 08:16:41 2010.08.02 01:12 Tester: PrevBalance: 500.00, PrevPL: 0.00, PrevEquity 500.00, PrevMargin: 0.00, NewMargin: 653, FreeMargin: -153.05

This is a demo account. Is one lot a lot, sorry???? And what is the new margin, free margin?


Free Margin is a free margin for opening an order with the corresponding (to this margin) volume.

Since " FreeMargin: -153.05 ", no orders will open at all as this value is negative.

See the calculator . For example, you can enter in different values and see how much margin you need for a given size of the position,

To open 1 lot on the Eurobucks we would need $265 of free margin with 1:500 leverage. The point value is equal to $10.

 
Thank you!!!!!! Thank you very much!!!
 

Guys, help... I'm confused.

here's the problem - how to keep the script on the chart :(

Here's an example of a script...It closes all trades if the total value :

nt start()
{

int i;
bool k=1;
//----

while (k==1) {

if ((AccountProfit()>=500) || (AccountProfit()<=-300))
{

for(i=OrdersTotal()-1; i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS))
{
if (OrderType() == OP_SELL)
OrderClose( OrderTicket(),OrderLots(), Ask, 20, 0 );
}
}



for(i=OrdersTotal()-1; i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS))
{
if (OrderType() == OP_BUY)
OrderClose( OrderTicket(),OrderLots(), Bid, 20, 0 );
}
}
}
k=0;
}
return(0);
}

I want it to hang until the account profit is broken in one of the directions (in this case 500 and -300)

 
Please advise how to register a condition in the EA, so that when the order is opened, it opens only one order and until this order is not closed at stop loss or take profit, the other one will not open
 
link1:
Please advise how to register a condition in the EA, so that when the order is opened, it will open only one order and until this order is not closed at stop or take profit, the other will not open

int ticket, total; //<---забыл указать...сорри

total = OrdersTotal();
if(total < 1){

ticket=OrderSend(...);

}


 
DOCTORS:

int total;

total = OrdersTotal();
if(total < 1){

ticket=OrderSend(...);

}




Thank you very much! )
Reason: