ticket=OrderSend(Symbol(),OP_BUY,ManualLots,Ask,Slippage,StopLossLevel,TakeProfitLevel,Koment,MagicNumber,0,DodgerBlue); ticket=OrderSend(Symbol(),OP_BUYLIMIT,ManualLots,Ask+0.001,Slippage,10,10,Koment,MagicNumber,0,DodgerBlue)
Play videoPlease edit your post.
For large amounts of code, attach it- Check your return codes What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
- You are not
adjusting
SL, TP, and slippage; for 4/5 digit brokers
and for JPY pairs.
double pip = StringFind(_Symbol,"JPY") < 0 ? 0.01 : 0.0001;0.001 is 10 pips on non-jpy pairs but 1/10 pip on JPY pairs.
int pipDigits = (int)MathLog10(pip/_Point);
int pipsToPoints = int(pip / _Point);
int slippage = 3 * pipsToPoints; - "10" is not a valid stop loss or a take profit. You need a price. The first send works because the extern's are zero.
Please edit your post.
For large amounts of code, attach it- Check your return codes What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
- You are not
adjusting
SL, TP, and slippage; for 4/5 digit brokers
and for JPY pairs.
double pip = StringFind(_Symbol,"JPY") < 0 ? 0.01 : 0.0001;0.001 is 10 pips on non-jpy pairs but 1/10 pip on JPY pairs.
int pipDigits = (int)MathLog10(pip/_Point);
int pipsToPoints = int(pip / _Point);
int slippage = 3 * pipsToPoints; - "10" is not a valid stop loss or a take profit. You need a price. The first send works because the extern's are zero.
1. FIXED
2. good reads i def need to dig pages deep into these
3. ive adjusted for this by just shifting my input decimal places, and only trade eur/usd
but assuming i copy and paste this in will be a great universal fix?
4. ok i see i got ahead of myself, so TakeProfitLevel is a function that determines a price from the TakeProfit
if i make a TakeProfitLevel2 with a different function and apply to my second position opened, will this Take Profit only effect the second position?
i know there are issues will FIFO rule so i will have to make it sequential exit
but i know when i set a manual TP all positions close and i dont like that
3) not universal see https://www.mql5.com/en/forum/169828#comment_4075614 #3
FIFO) If your TP on the second send is larger than the first that complies with FIFO. But my broker won't let them be different. You'll have to use the maximum and close the first order at a hidden SL.
3) not universal see https://www.mql5.com/en/forum/169828#comment_4075614 #3
FIFO) If your TP on the second send is larger than the first that complies with FIFO. But my broker won't let them be different. You'll have to use the maximum and close the first order at a hidden SL.
ok so perhaps the issue is my broker only allowing one TP level? im using forex.com
any link to code using a "hidden SL" or tp?
jazzpur: any link to code using a "hidden SL" or tp?
|
|
|
ok so with that code i need to get the return value from the order A, and B
ill need to create
int ticketA; int ticketB; ticketA=OrderSend(Symbol(),OP_BUY,ManualLots,Ask,Slippage,StopLossLevel,TakeProfitLevel,Koment,MagicNumber,0,DodgerBlue); ticketB=OrderSend(Symbol(),OP_BUY,ManualLots,Ask-0.001,Slippage,StopLossLevel,TakeProfitLevel,Koment,MagicNumber,0,DodgerBlue);
am i defining that right?
then for ticket A i use
static double hiddenSL, hiddenTP; for(...){ if(OrderSelect(...){ if(Bid < hiddenSL || Bid > hiddenTP) CloseOrder(); } } #define NO_SL 0 if(condition){ hiddenSL=...; hidenTP=...; ...OrderSend(..., NO_SL, NO_TP...); }
ticket B i will let ride until hard stops
am i getting somewhere close?
sorry im still new at this, what you are saying is still pretty advance to me
ok so with that code i need to get the return value from the order A, and B
ill need to create
am i defining that right?
then for ticket A i use
ticket B i will let ride until hard stops
am i getting somewhere close?
sorry im still new at this, what you are saying is still pretty advance to me
and now
if(OrderSelect(ticketA, SELECT_BY_TICKET)==true) .......
is that the correct syntax to continue with your hidden exits?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
im learning to to code by modifying existing EAs so please bear with me
im having trouble getting this technique to work
i figured out how to simply load up multiple orders upon a condition
so my entries grab two positions
but how do i hold onto one, and close the other at 20pips profit, unless reversal..in that case all close
it seems when i use TP and SL all positions close
im assuming this must be a magic number issue but everthing i try seems to not function properly
do i somehow need to make all the orders different magic numbers??