[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 135
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
Hello, I took the script from S. Kovalev's tutorial as the basis. I want to make an Expert Advisor to open a trade, put a stop loss, take profit and then wait for the end of the trade (i.e. the stop loss or profit), and only then reopen the trade. I tried with cycle and cycle interruptions. Please advise how to do this. I thought it may be easier not to set stop-loss and take-profit at once, and for the price to close when it approaches a certain level. But I don't want to do it that way because I'm afraid of slippage, and every point is important to me. If I try to open one deal or a couple at once, I cannot open a new one.
//+------------------------------------------------------------------+
int start() //---- function start
{
double //---- declare variables
x,
y;
//+------------------------------------------------------------------+
OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Ask-15*Point,Ask+15*Point); //---- market order to buy and put a stop and profit 15 points from the opening price
//+------------------------------------------------------------------+
while(x!=Ask-15*Point||y!=Ask+15*Point) //---- of the condition I want the trade to be closed until the previous trade is closed, i.e.е. it is possible to
{//----- keep ONLY one trade open
continue;//---- interrupt the condition and go to the next step
}
//+------------------------------------------------------------------+
return;//---- function return
}
//+------------------------------------------------------------------+
Yes, only open prices, that's why it's important to consider it when analyzing the EA. For example if a candle's tail breaks your channel, the Expert Advisor may not see it, but you can change the program logic and solve the problem.
Q: Here is a piece of code
int init()
{//----
ShiftSignal=0;
SlowPer=FastPer+AddSlow;
Spread=MarketInfo(Symbol(),MODE_SPREAD);
Comment("ExpertMagicNumber=",ExpertMagicNumber);
if ((FastShift<0)&&(SlowShift>=0))
ShiftSignal=FastShift;
if ((FastShift>=0)&&(SlowShift<0))
ShiftSignal=-SlowShift;
if ((FastShift<0)&&(SlowShift<0))
{
if (MathAbs(FastShift)>MathAbs(SlowShift))
ShiftSignal=-FastShift;
else
ShiftSignal=-SlowShift;
}
//----
return(0)
I'm interested in this fragment
if ((FastShift<0)&&(SlowShift>=0))
ShiftSignal=FastShift;
if FastShift<0, it means that FastShift initially equals to a negative integer number, for example: -2
then in the next line ShiftSignal=FastShift;
one would think that the value -2 would be assigned to the ShiftSignal variable instead of zero
but at the same time you may wonder why there's minus in front of the FastShift variable
Because in mathematics, minus for minus is plus, i.e. the value will be "+2", i.e. just 2.
If you need, I can send you all the code.
Help me solve a problem like this.
There is a signal to buy or sell, But the next bar also satisfies the condition as the signal on the next bar is not considered.
How do I do it, but it doesn't work.
But it does not work...or how it can be done differently???? I would be grateful if you could share your knowledge.
If anyone is reading and has faced the same problem Here is the Answer:
Since no one has answered, I'll try to reformulate my question.
Is there any way to pull information from compiled indicator, if iCastom() function gives only zeros?
Hello, advise how to start bar counting, after a positive indicator signal
- I get a signal, open bay, only after the next 2 bars go up .
Oleg, the condition is not very strict e.g. start counting open orders, if more than 1 do not open (use ready to use functions on this site)
Unfortunately signals can also be repeated (in the sense of buying more, they can be an hour later, a day later, etc.) I have been through OrderComment, blocking, but there are also repeated orders. I would like to block on bars for repeated signals. If through Sleepage, timeframe is different and 4 hours....
If you do not know what to do with it, you will get a wrong answer.
Unfortunately signals can also be repetitive (in the sense of extra, they can be an hour later, a day later, etc.) I've been through OrderComment, block, but there are also repetitive orders. I would like to block on bars for repeated signals. If through Sleepage, timeframe is different and 4 hours....
But thanks for the answer.
Search the website for the branch
Banning trading in one bar.