OmondiLuoDollar:
I initially wrote this message in a genera section and was advised to write it here. I also gave my code in sections that could not compile. So here my message again.
int TheOrderType=OrderType(); string TheChartSymbol=Symbol(); double M_Ask=MarketInfo(Symbol(),MODE_ASK); double M_Bid=MarketInfo(Symbol(),MODE_BID);
I have made an attempt using the following code but it doesn't seem to be working as I wish.
- Your original post was moved. Don't double post.
- You can not use any Trade Functions unless you select an order first. That variable is not being updated. Move it in inside OnTick.
- That variable is not being updated. Move it in inside OnTick.
- That variable is not being updated. Move it in inside OnTick.
if(Ask>=U+D) {SendanOrder(OP_SELL,Lots,0,0);}
D and U have random values, your code is meaningless.- "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here. Print out your variables, and find out why.
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
Hallo fellow community members,
I initially wrote this message in a genera section and was advised to write it here. I also gave my code in sections that could not compile. So here my message again.
I am trying to put up my very first EA but am kind of stuck with a certain part of the code. I want to have eight price levels at which I will place trades, more or less like a grid. Normally this would be done using pending orders but this option will complicate the code for a learner like me because the EA will have to keep finding and deleting pending orders which have been rendered irrelevant for the cycle. I therefore prefer a code that will wait until price reaches that point then places a market order. Here is what I have written so far.
I will place an order using my entry criteria - if the criteria signal a buy, I will place a buy market order. If the signal is for sell, I will place a sell market order. I have not included the criteria in the code because it is still a concept in my head and not part of the current problem. The list of errors in the ErrorDescription() function is also not exhaustive because that would make the code unnecessarily long.
This is the part I have a problem coding because what I have so far doesn't seem to work: Once I have a trade running, there will be eight different price levels, ich of which is "D" PIPs from the next (D is defined in the code). Trades will be entered at those levels depending on how the market behaves. If my trade is a buy, then its OrderOpenPrice() will be the 5th level, such that there will be three levels above it and four below. The immediate lower level hedges it to stop further loss. If it is a sell, then the OrderOpenPrice() will be the 4th level such that there will be three below and 4 above, the immediate upper one being a hedge as well. Then I will have a code that says if price reaches level x, place a buy trade or a sell trade (depending on whether it is above or below the OrderOpenPrice()) Say, for instance that I want to enter hedge (buy and sell) at level 6 and only a sell at level 7. I have made an attempt using the following code but it doesn't seem to be working as I wish.
Once again, I will highly appreciate any pointers as to what I am doing wrong and how I can get on the right path.