[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 78
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
The condition under the 1st conditional if statement applies only to the next statement after it (the next line).
The others are executed UNLESS. That is, even if there is no command to close an order, one of the playsounds will work.
The correct way is this:
The thing is that both playsounds work - PlaySound("timeout.wav") works, after it PlaySound("money.wav"), the deal closes normally, but before its closing there is a playsound error and this thing works only for short deals, for long deals everything is normal - PlaySound("money.wav") if closed and PlaySound("timeout.wav") if error, same design for long and short trades. I'll try to put brackets as you described, I don't know if it's in them))
... >> I'll try brackets like you described, I don't know if that's it.)
It's hard to get a positive result with that approach.
With such an approach it is difficult to achieve a positive result.
I am deeply convinced that the result does not depend on the way the text is presented on the forum)) At least I do not include myself to the intelligentsia, but it's bullshit all off the subject)).
I made brackets for order sending, the same thing, first an error sound then a closing sound. For long ones everything is ok as it was before. So everything works of course, just recently inserted a function to see what kind of errors, that's why this sound appeared before the closing sound, and before that I didn't notice it, of course - everything works
OK, just for reference. The PlaySound() command does not wait for the previous sound to finish, but simply interrupts and starts its own sound. In a fast loop, intermediate sounds may be absorbed.
OK, just for reference. The PlaySound() command does not wait for the previous sound to finish, but simply interrupts and starts its own sound. In a fast loop, intermediate sounds may be absorbed.
If it were only in the sound, the error "No error" pops up in the log for any close of short trades, 3 trades are closed - 3 errors, etc., but after that all is closed and the log is prescribed closing, for long trades, all is normal and the sounds work as intended, and the error is not prescribed, I put a slip for 3 seconds and 5 seconds, all the same, only with the appropriate delay
If only in the sound was the matter, the error "No error" pops up in the log at any close short trades, 3 trades are closed - 3 errors, etc., but after that all is closed and the log prescribed closing, for long trades are fine, and the sound works as intended, and the error is not prescribed, inserted a slip for 3 seconds and 5 seconds, everything the same, but with the appropriate delay
You know, I had a similar thing, I struggled, I put delays, no progress. Then I checked if order was closed by
if(OrderCloseTime()!=0)
All my problems disappeared at once. Try it.
Can you give me a hint, please. There is a variable, which should be calculated for each bar individually i.e. [i+1]=0.9, [i+2]=0.8, [i+3]=1,5........ but what I have is that the last calculated value is applied to all bars on history......... if last 1, then [i+1]=1, [i+2]=1, [i+3]=1 and if last 2, [i+1]=2, [i+2]=2, [i+3]=2 respectively....
It's so hard to tell, post that piece of code in full.
If you need to debug, use Print()
But in most cases you don't need it.
Well, I'm of a different opinion. I'm writing an Expert Advisor now, and I'm having a lot of trouble without a proper debugger. Especially with data arrays.
To be sure that the algorithm works correctly, I need to analyze the data obtained when calculating indicators. And there is not only one array.
Is there no other tool available besides Print(), Comment(), Alert()?
What the hell is this? What is OrderSelect() for?
In the rest it's difficult to understand, because the code is laid out without indentation and one cannot follow brackets - I don't want to ruin my eyesight.
Ok, let's skip the bullshit and don't spoil our eyesight.
/---- input parametersextern int PerRSI=8;
extern int MagicNamber=77771;
extern double Lots=1.0;
//+------------------------------------------------------------------+
int start()
{
int
type, //order type
cnt, // order index
ticket, // identification number of the order
total; // number of already open orders
double
rsi_0, // Value. rsi_0 current
rsi_1; // Value. rsi_1 1st bar
rsi_0=iRSI (NULL, 0, PerRSI, 0, 0); // Current bar
rsi_1=iRSI (NULL, 0, and PerRSI,0, 1); // Current bar plus 1
if(rsi_0 < rsi_1 && rsi_1 < 30) // if line has crossed 30
ticket=OrderSend (Symbol(), OP_BUY,Lots, Ask, 3, 0, 0, "My RSI", MagicNamber, 0, Green);
OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES);
if(rsi_0 > rsi_1 && rsi_1 > 60) // if the line has crossed 70
OrderClose(ticket, OrderLots(), Bid, 3, Violet ); // close position
return(0); // exit
}
why scoop buys and does not close, no errors when committing