[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 613

 
yosuf:
Why? For example, a BAY order is open at O= 1.2900 with a TP of 1.300 and a SL of 1.300. The pending order should have the parameters BAY O= 1.2800 with TP 1.2900 and SL 1.2700. If possible, please consider the spread to be lost.


The first order has an open price of 1.2900 and TP of 1.300. The second order has an open price of1.2800 and TP of 1.290. These are different parameters. The first one is BAY, the second one is BAY_STOP. These are also different parameters. And when you close on the SL, you lose not the spread, but much more (spread+SL*Point).
 
rigonich:

Let's begin:

1.If(Stoch_1>Stoch_2) flag1=1 ; , then the condition following it (Stoch_1<Stoch_2 && flag1==1) cannot in principle be true, because if Stoch_1<Stoch_2 flag1==0 and if flag1==1then Stoch_1>Stoch_2. it is the same with all subsequent conditions in this function, so only flag1 can change the value. That is, your program will execute the first two lines, skipthe third, executethe fourth, skipthe fifth, execute the sixth, execute the seventh, and skip all the others.


You're wrong, because you just don't get the point. It does, and everything works perfectly, just the way I need it to. Maybe the code could be simplified, but now it's no longer to the fat... I just need to finish the whole EA and already look at the REST of the trading idea it contains....

and programming for programming's sake doesn't interest me much...

 
xant:

Yes, I did as you wrote. And it doesn't compile.

Obviously, I've done something wrong, but what exactly I don't understand. You could go through it step by step.

For the sake of interest, show me my functions which you have converted to your variables. And show me the log with compilation errors.
 
rigonich:

The first order has an open price of1.2900 and a TP of 1.300. The second order has an open price of1.2800 and a TP of 1.290. These are different parameters. The first one isBAY, the second one isBAY_STOP. These are also different parameters.
But, I guess, you got the point?
 
lottamer:


You are wrong because you just don't understand the point. And it does, and everything works perfectly the way I need it to. Maybe the code could be simplified, but now it's no longer a question of fat... I just need to finish the entire EA and already look at the return on the trading idea it contains....

I am not interested in programming for the sake of programming...


I think that's exactly what you have - programming for programming's sake. your function does nothing but overload the CPU.

I started programming after five years of studying the market, developing and trying out various strategies, when I realized that the trading strategy (successful) developed by me and manually tested 20 times on history, first, does not have analogues, that they can be found in kodobase, and secondly, even with settings close to the limits of technical capabilities, it sets demands that are impossible for humans, and can be easily met even by the weakest computer (for example, stay with your computer for a week or more).

 
yosuf:
But I guess you got the point?


Simply place a pending order with the parameters you want.

P.S. In the EA -- right after the order opens.

 
rigonich:


Just place a pending order with the parameters you want.

P.S. In the EA -- right after the order is opened.

What is the code?
 
yosuf:
What's the code?


int OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, int magic=0, datetime expiration=0,arrow_color=CLR_NONE)
, Basic function used to open a position or set a pending order.
Returns the ticket number that is assigned to the order by the trade server or -1 in case of failure. To get more information about the error, call GetLastError().
Notes.
When opening a market order (OP_SELL or OP_BUY), only the latest Bid (for selling) or Ask (for buying) prices may be used as the opening price. If the operation is performed for a financial instrument, different from the current one, then to get the latest quotes for this instrument, one should use the MarketInfo() function with the MODE_BID or MODE_ASK parameter. An estimated or non-normalized price cannot be used. If the requested opening price was not in the price flow or the requested price is not normalized according to the number of decimal places, error 129 (ERR_INVALID_PRICE) will be generated. If the requested opening price is severely out of date, an error 138 (ERR_REQUOTE) will be generated regardless of the value of the slippage parameter. If the requested price is out of date but still present in the price flow, the position will be opened at the current price and only if the current price falls into the price+-slippage range.

StopLoss and TakeProfit prices may not be placed too close to the market. The minimum stop distance in pips can be obtained using the MarketInfo() function with the MODE_STOPLEVEL parameter. Error 130 (ERR_INVALID_STOPS) is generated in case of erroneous or non-normalized stops.

When placing a pending order, the opening price cannot be too close to the market. The minimum distance of the pending price from the current market price in points can also be obtained using the MarketInfo() function with the MODE_STOPLEVEL parameter. If the pending order open price is incorrect, error 130 (ERR_INVALID_STOPS) will be generated.

On some trade servers a ban on expiration of pending orders can be set. In this case an error 147 (ERR_TRADE_EXPIRATION_DENIED) will be generated when trying to set a non-zero value in the expiration parameter.

On some trade servers a limit on the total number of open and pending orders can be set. If this limit is exceeded, a new position will not be opened (no pending order will be set) and the trade server will return error 148 (ERR_TRADE_TOO_MANY_ORDERS).
Parameters:
symbol - Name of the financial instrument, with which the trade operation is executed.
cmd - Trade operation. Can be any of the trade values.
volume - Number of lots.
price - Opening price.
slippage - Maximum permitted price slippage for market orders (buy or sell orders).
stoploss - The price of closing a position when the loss is reached (0 if there is no loss).
takeprofit - The close price of a position when the profitability level is reached (0 if there is no profitability level).
comment - Order comment text. The last part of the comment can be changed by the trading server.
magic - Magic number of the order. Can be used as a user-defined identifier.
expiration - Expiration time of the pending order.
arrow_color - Colour of the opening arrow on the chart. If the parameter is missing or its value is CLR_NONE, the opening arrow is not shown on the chart.
Example:
 int ticket; if(iRSI(NULL,0,14,PRICE_CLOSE,0)<25) { ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,Bid-25*Point,Ask+25*Point, "My order #"+counter,16384,0,Green); if(ticket<0) { Print("OrderSend failed with error #",GetLastError()); return(0); } }
 
lottamer:

and even though your code gave out 24 errors in the compiler!!! still thanks even for the careless help.... for the idea... (now it works - although I basically tried to do it that way but the punctuation let me down)


I didn't try to compile it, I just put the brackets in! Otherwise they wouldn't work at all. I showed how they must be. The rest of the logic is still unclear. I remember, putting every next flag, you ,,asked iff the opposite of the preceding condition, while checking if the flag was true...

In fact, my first comment urged you to reconsider what you wrote, checking the reference.

 
any tips for the newbie!!!! the advisor is disabled in the terminal but the stoploss is triggered is it possible ?
Reason: