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
Bragging? )
Either show the code or close the thread.
The code is scattered. Part of it is in the Expert Advisor, part of it is in the indicator. I will not post the entire Expert Advisor and indicator. If you are interested in a certain part, I can lay it out. Please advise what exactly you need.
I just don't understand why you need to maintain a thread if your issue has already been resolved and the rest of us get nothing out of the discussion.
Suggested to add constructive )
I just don't understand why you need to maintain a thread if your issue has already been resolved and the rest of us get nothing out of the discussion.
Suggested to add some constructiveness )
Ok, you got it ) I'm posting everything about dragging and dropping SL. For TP, I have not done so far, not particularly need it yet. But it is not a problem to do it by analogy. I am pasting the indicator in its entirety. I have pulled everything concerning the dragging of SL from the EA. I have not studied the innovations of the language, I do many things the old-fashioned way, so do not judge.
Code of indicator:
Pieces from EA:
//+----------------------------------------------------------------------------+ //| Автор : Ким Игорь В. aka KimIV, http://www.kimiv.ru | //+----------------------------------------------------------------------------+ //| Версия : 28.11.2006 | //| Описание : Модификация одного предварительно выбранного ордера. | //+----------------------------------------------------------------------------+ //| Параметры: | //| pp - цена установки ордера | //| sl - ценовой уровень стопа | //| tp - ценовой уровень тейка | //| ex - дата истечения | //+----------------------------------------------------------------------------+ void ModifyOrder1(double pp=-1, double sl=0, double tp=0, datetime ex=0) { bool fm; color cl=IIFc(OrderType()==OP_BUY || OrderType()==OP_BUYLIMIT || OrderType()==OP_BUYSTOP, clModifyBuy, clModifySell); double op, pa, pb, os, ot; int dg=MarketInfo(OrderSymbol(), MODE_DIGITS), er, it; if (pp<=0) pp=OrderOpenPrice(); if (sl<0 ) sl=OrderStopLoss(); if (tp<0 ) tp=OrderTakeProfit(); pp=NormalizeDouble(pp, dg); sl=NormalizeDouble(sl, dg); tp=NormalizeDouble(tp, dg); op=NormalizeDouble(OrderOpenPrice() , dg); os=NormalizeDouble(OrderStopLoss() , dg); ot=NormalizeDouble(OrderTakeProfit(), dg); if (pp!=op || sl!=os || tp!=ot) { for (it=1; it<=NumberOfTry; it++) { if (!IsTesting() && (!IsExpertEnabled() || IsStopped())) break; while (!IsTradeAllowed()) Sleep(5000); RefreshRates(); fm=OrderModify(OrderTicket(), pp, sl, tp, ex, cl); if (fm) { PlaySound("wait.wav"); break; } else { er=GetLastError(); PlaySound("timeout.wav"); pa=MarketInfo(OrderSymbol(), MODE_ASK); pb=MarketInfo(OrderSymbol(), MODE_BID); Print("Error(",er,") modifying order: ",ErrorDescription(er),", try ",it); Print("Ask=",pa," Bid=",pb," sy=",OrderSymbol(), " op="+GetNameOP(OrderType())," pp=",pp," sl=",sl," tp=",tp); Sleep(1000*10); } } } }
I haven't done a TP yet, I don't particularly need it yet.
That's why it's possible to pull the opening price up and put a SL in profit ;)
Thanks for the constructive feedback.
Hence the opportunity to pull the opening price up and put the SL in profit ;)
Thanks for the constructive feedback.
What does this have to do with takeprofit?
You should also add one condition to the ModifYSL(double priceModifySL=0) function just in case. As they say, you can't spoil a lot of porridge with butter).
We need to introduce another global variable to modify the TR. I called the global variable"ModifySL" for a reason. And then there's the GV "ModifyTP".
Yes, I can see that. What I mean is this: if the order has no stop, we can drag the line of the order itself, and the stop will be placed where we "drag" the line to. This is the case if we don't have takeout processing. And if we have processing of both stops and toes, but the order has neither, then if we draw the order line, what should we set? A Take or a Stop?
Got it. Then either make additional buttons to set the modification type, or do it the way it is done on the real chart. The initial direction of movement from the order price to determine what the TP or SL should pull.