Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 89
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
how do I determine the time of day trading in futures?
MarketInfo(Symbol(),MODE_STARTING)
MarketInfo(Symbol(),MODE_EXPIRATION)
returns zeros
which broker ?
So first of all, you should check with your broker.
Dear forum members, how to write the condition of crossing the channel line by the price in your Expert Advisor, for example, the price crosses the channel line from above and the trade is opened or closed? Please note that I am interested in the moment of this crossover. I would be glad to help.
double price0=NormalizeDouble(ObjectGetValueByShift("NameYourChannelLine", 0),Digits)); - value of your line on bar 0.
double price1=NormalizeDouble(ObjectGetValueByShift("NameYourChannelLine", 1),Digits)); - value of your line on bar 1.
And the simplest way to determine the moment of breakdown on the zero bar: if(High[0]>price0 && High[1]<=price1) {the line has broken through upwards}, if(Low[0]<price0 && Low[1]>=price1) {the line has broken through downwards}. The ifs will be TRUE from the moment of the breakthrough until the end of the current bar. It is desirable that your channel line has the property OBJPROP_RAY==True
Dear forum members, how to make a condition in an EA for crossing the channel line, for example, if the price crosses the channel line from above and a deal is opened or closed? Please note that I am interested in the moment of this crossover. I would be glad to help.
A couple of ways:
If Ask > channel line and Low[1] <=channel line, cross upwards
If Bid < channel line and High[1] >=channel line, cross downwards
You may check with MA with period 1
. I must have put the question incorrectly, I should have attached part of the code. I stand corrected.
As suggested by
artmedia70 indicated the intersection to close as follows. It closes the deal according to the screenshot. But we need to close the deal where the cross is
void CheckForClose()
{
double PriceHigh, PriceLow;
//---- go trading only for first tiks of new bar
if(Volume[0]>1) return;
PriceHigh = iCustom (Symbol(), 0, "ExtremeTMALine", TimeFrame, HalfLength, Price, ATRMultiplier, ATRPeriod, Interpolate, TrendThreshold, Distances, 1, 0);
PriceLow = iCustom (Symbol(), 0, "ExtremeTMALine", TimeFrame, HalfLength, Price, ATRMultiplier, ATRPeriod, Interpolate, TrendThreshold, Distances, 2, 0);
for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if(OrderMagicNumber()!=124 || OrderSymbol()!=Symbol()) continue;
//---- check order type
if(OrderType()==OP_BUY)
{
if(Low[1]<=PriceHigh && Ask>=PriceHigh ) OrderClose(OrderTicket(),OrderLots(),Bid,3,White);
break;
}
if(OrderType()==OP_SELL)
{
if(High[1]>=PriceLow && Bid<=PriceLow) OrderClose(OrderTicket(),OrderLots(),Ask,3,White);
break;
}
}
//----
}
how can you select the last CLOSED order in the software and get information from it?
You can find anything you like.
Thank you for your help
. I must have put the question incorrectly, I should have attached part of the code. I stand corrected.
As suggested by
artmedia70 indicated the intersection to close as follows. The deal is closing according to the screenshot. But we need to close the deal where the cross is
void CheckForClose()
{
double PriceHigh, PriceLow;
//---- go trading only for first tiks of new bar
if(Volume[0]>1) return;
PriceHigh = iCustom (Symbol(), 0, "ExtremeTMALine", TimeFrame, HalfLength, Price, ATRMultiplier, ATRPeriod, Interpolate, TrendThreshold, Distances, 1, 0);
PriceLow = iCustom (Symbol(), 0, "ExtremeTMALine", TimeFrame, HalfLength, Price, ATRMultiplier, ATRPeriod, Interpolate, TrendThreshold, Distances, 2, 0);
for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if(OrderMagicNumber()!=124 || OrderSymbol()!=Symbol()) continue;
//---- check order type
if(OrderType()==OP_BUY)
{
if(Low[1]<=PriceHigh && Ask>=PriceHigh ) OrderClose(OrderTicket(),OrderLots(),Bid,3,White);
break;
}
if(OrderType()==OP_SELL)
{
if(High[1]>=PriceLow && Bid<=PriceLow) OrderClose(OrderTicket(),OrderLots(),Ask,3,White);
break;
}
}
//----
}
ExtremeTMA - ungodly overdrawing. It's a big chunk of history - the last 30 bars, if not more. I used it to write an Expert Advisor - it is rubbish. Imagine: a signal appears, I reached it, but some time later the signal does not exist on the history - the indicator re-drawn and it turns out that I have entered for nothing
You made a mistake when determining the crossing: if(Low[1]<=PriceHigh && Ask>=PriceHigh ) ... you should write if(Low[1]<=PriceHigh && Ask>PriceHigh ) ... And for the opposite by analogy.
Insert the code with button SRC in the panel at the top of input window of your message
ZZZY So where's the screenshot with the cross?
ExtremeTMA - they're ungodly overdrawn. And a huge chunk of history - the last 30 bars, if not more. I used it to write an Expert Advisor - it sucks. Just imagine: I got a signal, entered it, and some time later the signal does not exist on the history - the indicator made too many redraws and it turns out that I entered the market in vain
You made a mistake when determining the crossing: if(Low[1]<=PriceHigh && Ask>=PriceHigh ) ... you should write if(Low[1]<=PriceHigh && Ask>PriceHigh ) ... And for the opposite by analogy.
SZY The code should be pasted by pressing the SRC button in the panel at the top of text entry window
Corrected, closed the trade the same way as in the screenshot above, and should be where the red cross is.
I agree that ExtremeTMA redraws, but I guess it does not affect the search for entry points, the main thing here is the filters. I used TDI indicator. I attached attached what I made (I don't have good hands, that's why the Expert Advisor is a good project ). I have only one problem with it, it takes about 5 hours in tester for 1 year (I have made one mistake somewhere). If it is not difficult to look for errors.
Corrected, closed the trade the same way as in the screenshot above, but where the red cross should be.
I agree that ExtremeTMA is overdrawing, but I guess it doesn't affect the search for entry points, the main thing here is the filters. I used TDI indicator. I attached attached the tip (my hands are not straightforward, the Expert Advisor project is just like my hands). I have only one problem with it, it takes about 5 hours in tester for 1 year (I have made one mistake somewhere). If it is not difficult to look for errors.
Haven't looked for errors yet - plenty to do.
In order to close Sell where the red cross is, you need to check on the current bar. If Ask<= close level && High[1]>close level