ObjectGet("line",OBJPROP_PRICE1)
..
..
Ok, I'm embarassed... :) need more coffee.
NICE! It lives! sort of... Now it plots something like 1.135846854955456!
But the the trigger doesn´t work, maybe i´m not following.
is this
the same as this?
on the second case it works like a charm. On the first, it doesn´t. Do i need to cut number of digits? or the value I get with ObjectGet isn´t ready to be used yet?
Thank you...
How have you written the code for opening the trade on that trigger?
How have you written the code for opening the trade on that trigger?
Hi Honest_Knave,
this is the part that refers to stop orders, I have other order types on the code but don´t really use them:
//StartTime Orders if(StopOrder) { if(!CountBuyStop && !Count) { //BUY BEven = False; double TriggerOrder = NormalizeDouble(Trigger+PriceOrder*Point+Spread,Digits); double minstoplevel=MarketInfo(Symbol(),MODE_STOPLEVEL); //Print("Minimum Stop Level=",minstoplevel," points"); sl=NormalizeDouble(Trigger - Spread - StopLoss*Point + PriceOrder*Point,Digits); if ( sl < minstoplevel*Point) sl = (Trigger - Spread - minstoplevel*Point); if(Ask < TriggerOrder) { ORDO = OrderSend(Symbol(),OP_BUYSTOP,Lots,TriggerOrder,3,sl,0,"BotOrderBuyStop",MagicStop,0,Lime); Comment("BUYSTOP order opened","\n"); if(!ORDO) Alert("The BUYSTOP order isn't opened because error nº", GetLastError()); else Print("The BUYSTOP order was opened successfully."); } }
PriceOrder refers to the distance in pips to the Trigger where the stop order is supposed to be.
So, as mentioned, when I define manually the Trigger value (Price) it works as expected. Maybe replacing that value by the value returned by the expression ObjectGet isn´t the way to go...
Can the problem be the number of times it reads price? I mean, when i type the price manualy it it is fixed and defined only once. When I ask it to read the value of the horizontal line it constantly reads the value... like a few times every second... it plots ALOT of these lines... is it bad?
2015.11.08 12:56:41.789 2015.10.08 10:33 LC_line up dn 03 EURUSD,H4: 1.117820675105485
2015.11.08 12:56:41.789 2015.10.08 10:33 LC_line up dn 03 EURUSD,H4: 1.117820675105485
2015.11.08 12:56:41.789 2015.10.08 10:33 LC_line up dn 03 EURUSD,H4: 1.117820675105485
2015.11.08 12:56:41.789 2015.10.08 10:33 LC_line up dn 03 EURUSD,H4: 1.117820675105485
2015.11.08 12:56:41.789 2015.10.08 10:33 LC_line up dn 03 EURUSD,H4: 1.117820675105485
2015.11.08 12:56:41.789 2015.10.08 10:33 LC_line up dn 03 EURUSD,H4: 1.117820675105485
2015.11.08 12:56:41.789 2015.10.08 10:33 LC_line up dn 03 EURUSD,H4: 1.117820675105485
2015.11.08 12:56:41.789 2015.10.08 10:33 LC_line up dn 03 EURUSD,H4: 1.117820675105485
2015.11.08 12:56:41.789 2015.10.08 10:33 LC_line up dn 03 EURUSD,H4: 1.117820675105485
- How are you getting the name of the line?
- Check/Print _LastError after the ObjectGet

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
i´ve been trying to make my ea read the price of an horizontal line to work as a trigger. I can type the price manually and it´ll work the way I want, but if i could "type" it graphically would be great.
I´m not an expert coder... :)
I used ObjectGet. Note that I also place a horizontal line on the chart and call it "line".
double Trigger = ObjectGet(line, 1) ;
when I type
Print (ObjectGet(line, 1)) ;
it plots "0.0" so i know it´s not reading anything
Im I oversimplifying this, or using the wrong expression? Can anyone shed some light?
thanks in advance