It was exactly what I wanted . Now the formula gives two lines below the lows of the first two clicks on the chart. Is there any way to have the first line below the low and the second above the high of the candle relative to the second point clicked on the chart? It would have to be separate in the formula ? I tryed calling the " caseCHARTEVENT_CLICK:" again and rename everything, but then it shows a message saying "case value already used".
What I'm trying to get and may be usefull to the community is two lines which will give me the entry and stoploss values, by clicking on the chart to set these points (high and low) with offsets (in pips) , to then calculate profit targets. So a tool easy to use for scalping.
Thanks for helping me
Here is the formula until now:
//+------------------------------------------------------------------+//| T7B.mq5 |//| Copyright 2014, MetaQuotes Software Corp. |//| http://www.mql5.com |//+------------------------------------------------------------------+#property copyright"Copyright 2014, MetaQuotes Software Corp."#property link"http://www.mql5.com"#property version"1.00"//inputstring InpName="ArrowBuy"; // Object name//---MqlRates candle[];
//+------------------------------------------------------------------+//| Script program start function |//+------------------------------------------------------------------+voidOnInit()
{
//---ArraySetAsSeries(candle,true);
}
//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+voidOnChartEvent(constint id,
constlong &lparam,
constdouble &dparam,
conststring &sparam)
{
//---int visibleBars = (int)ChartGetInteger(0,CHART_VISIBLE_BARS,0);
//---CopyRates(_Symbol,_Period,0,visibleBars,candle);
//---double tickSize = SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_SIZE);
//--- string comment="Last event: ";
//--- select event on chartswitch(id)
{
//--- 1caseCHARTEVENT_CLICK:
{
comment+="6) mouse click on chart";
//--- object counter staticuint sign_obj_cnt=0;
if( sign_obj_cnt>=2) return;
string buy_sign_name="buy_sign_"+IntegerToString(sign_obj_cnt++);
//--- coordinates int mouse_x=(int)lparam;
int mouse_y=(int)dparam;
//--- time and pricedatetime obj_time;
double obj_price;
int sub_window;
//--- convert the X and Y coordinates to the time and price valuesif(ChartXYToTimePrice(0,mouse_x,mouse_y,sub_window,obj_time,obj_price) )
{
//---int barPos = Bars(_Symbol,_Period,obj_time,TimeCurrent());
//--- create object LINE 1if(!ObjectCreate(0,buy_sign_name, OBJ_HLINE,0,obj_time,candle[barPos].low-(20*tickSize))) //OBJ_ARROW_BUY
{
Print("Failed to create buy sign!");
return;
}
}
}
}
//---Comment(comment);
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Great man,
The formula below let me draw as many lines as I click on the chart, but I would like to limit to only two lines. Any idea?
Great man,
The formula below let me draw as many lines as I click on the chart, but I would like to limit to only two lines. Any idea?
It was exactly what I wanted . Now the formula gives two lines below the lows of the first two clicks on the chart. Is there any way to have the first line below the low and the second above the high of the candle relative to the second point clicked on the chart? It would have to be separate in the formula ? I tryed calling the " case CHARTEVENT_CLICK:" again and rename everything, but then it shows a message saying "case value already used".
What I'm trying to get and may be usefull to the community is two lines which will give me the entry and stoploss values, by clicking on the chart to set these points (high and low) with offsets (in pips) , to then calculate profit targets. So a tool easy to use for scalping.
Thanks for helping me
Here is the formula until now: