New Hotkeys for Multicharts

Questions about MultiCharts and user contributed studies.
mickatrade
Posts: 114
Joined: 12 Jul 2015
Has thanked: 20 times
Been thanked: 16 times

New Hotkeys for Multicharts

Postby mickatrade » 04 Jan 2016

Hello,
I was thinking about new hotkeys for next releases of Multicharts.
What do you think about a hotkey to close xx % of the position ?
The will have to define the proportion of the position he wants to close when adding the hotkey.

Mickael

sptrader
Posts: 742
Joined: 09 Apr 2010
Location: Texas
Has thanked: 483 times
Been thanked: 274 times
Contact:

Re: New Hotkeys for Multicharts

Postby sptrader » 04 Jan 2016

I was thinking of something similar, using a mouse click instead of a hotkey.

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: New Hotkeys for Multicharts

Postby arjfca » 04 Jan 2016

I was thinking of something similar, using a mouse click instead of a hotkey.
This is feasible using the mouse click and a function attached to a Text button

This is the text menu button that I'm working on.
Mouse click button.png
(87.37 KiB) Downloaded 1349 times
This indicator as multiple use. One of them is to draw the Text button and section to activate a function when a given Text on chart is clicked.

Sure there is a lot to do between an idea and a final code, but one line at the time...

Martin

Extract:

Code: Select all

If LastBarOnChart then begin
//Get the location of the margin

HighestPrice = Getappinfo(aiHighestDispValue);
Lowestprice = Getappinfo(aiLowestDispValue);
RightMargin = Getappinfo(aiRightDispDateTime);
TheSpaceToRight = Getappinfo(aiSpacetoRight);
LeftDateTime = Getappinfo(aiLeftDispDateTime );
LeftSideOfScreenDate = JulianToDate(GetAppInfo(aiLeftDispDateTime));


TextVal = Text_setLocation_BN(Button_0_val,Barnumber + (TheSpaceToRight*.9), HighestPrice);
TextVal = Text_setLocation_BN(Button_1_val,Barnumber + (TheSpaceToRight*.9), (highestprice - (HighestPrice-Lowestprice) *.10));
TextVal = Text_setLocation_BN(Button_2_val,Barnumber + (TheSpaceToRight*.9), (HighestPrice - (HighestPrice-Lowestprice) *.20));
TextVal = Text_setLocation_BN(Button_3_val,Barnumber + (TheSpaceToRight*.9), (HighestPrice - (HighestPrice-Lowestprice) *.30));
TextVal = Text_setLocation_BN(Button_4_val,Barnumber + (TheSpaceToRight*.9), (HighestPrice - (HighestPrice-Lowestprice) *.40));
TextVal = Text_setLocation_BN(Button_5_val,Barnumber + (TheSpaceToRight*.9), (HighestPrice - (HighestPrice-Lowestprice) *.50));
TextVal = Text_setLocation_BN(Button_6_val,Barnumber + (TheSpaceToRight*.9), (HighestPrice - (HighestPrice-Lowestprice) *.60));
TextVal = Text_setLocation_BN(Button_7_val,Barnumber + (TheSpaceToRight*.9), (HighestPrice - (HighestPrice-Lowestprice) *.70));
TextVal = Text_setLocation_BN(Button_8_val,Barnumber + (TheSpaceToRight*.9), (HighestPrice - (HighestPrice-Lowestprice) *.80));
TextVal = Text_setLocation_BN(Button_9_val,Barnumber + (TheSpaceToRight*.9), (HighestPrice - (HighestPrice-Lowestprice) *.90));

TextVal = Text_SetLocation_s(Button_ReCalc_Val, LeftSideOfScreenDate, DateTime2ELTime_s(leftDateTime), HighestPrice );


ActiveButton= MC_Text_getactive;
// Print (activeButton:0:0);
If ActiveButton <> GetActive_PreviousValue then begin
// Print (ActiveButton:0:0, " ", GetActive_PreviousValue:0:0);
If activeButton = Button_0_Val then Capture_Text_Num;
If activeButton = Button_1_Val then begin
print ("go to function: ", text(Pair_And_Scale));
Boolean_Val = Open_Notes_File (text(Pair_And_Scale));
Print ("Return");
end;
If activeButton = Button_2_Val then Boolean_Val = Reset_Note_Number ;
If activeButton = Button_3_Val then playsound("C:\CLICK.WAV") ;
If activeButton = Button_4_Val then playsound("C:\CLICK.WAV") ;
If activebutton = Button_5_Val then Boolean_val = Centerfromarrow;
If activeButton = Button_6_Val then playsound("C:\CLICK.WAV") ;
If activeButton = Button_7_Val then playsound("C:\CLICK.WAV") ;
If activeButton = Button_8_Val then playsound("C:\CLICK.WAV") ;
If activeButton = Button_9_Val then Boolean_val = EraseArrow;
If activeButton = Button_Recalc_Val then recalculate;

GetActive_PreviousValue = Activebutton;
end;

end;

Code: Select all

[ProcessMouseEvents = true]

Input:
WorkSpaceNumber (0),
ShowMenu (True);

vars:
SpacetoRight (0),
ClickonMargin (False),
BarNumberOfTheLastBar(0),
Comma (""),
BarInfo_Str (""),
Astring (""),
vClickBarHigh_S (""),
vClickBarLow_S (""),
vClickBarOpen_S (""),
vClickBarClose_S (""),
vClickPrice_S (""),
vClickBarNbr(0),
vLastBar(0),
vBarsAgo(0),
vClickBarHigh(0),
vClickBarLow(0),
vClickBarOpen (0),
vClickBarClose (0),
vClickPrice (0),
vclickdatetime (0),
vclickDateTime_S (""),
AmouseClick (false),
Amouseclick_CTRL (False),
VclickDateTime_CTRL (0),
ClickTime (0),
clickDate (0),
UpArrow (True),
BarNumberTarget (0),
GVVal (0),
scale (""),
HighestPrice (0),
LowestPrice (0),
RightSpace (0),
UpperPart (0),
LowerPart (0),
Button_1_High (0),
Button_1_Low (0),
Button_2_High (0),
Button_2_Low (0),
Button_3_High (0),
Button_3_Low (0),
Button_4_High (0),
Button_4_Low (0),
Button_5_High (0),
Button_5_Low (0),
Button_1 (False),
Button_2 (false),
Button_3 (false),
Button_4 (false),
Button_5 (false),
Boolean_Val (False),
TextVal (0),
Button_1_Val (0),
Button_2_Val (0),
Button_3_Val (0),
Button_4_Val (0),
Button_5_Val (0),
Button_6_Val (0),
Button_7_Val (0),
Button_8_Val (0),
Button_9_Val (0),
Button_0_Val (0),
Button_ReCalc_Val (0),
RightMargin (0),
TheSpaceToRight (0),
LeftDateTime (0),
LeftSideOfScreenDate (0),
ActiveButton (0),
ListID(0),
NotesNumber(0),
NotesString(""),
TextDawing_Number(0),
GetActiveDone (False),
Intrabarpersist GetActive_PreviousValue (0),
CharPos (0),
PairName (""),
Filename (""),
filename_B (""),
BN (0), //Bar number
PriceVal (0),
ValToShow (0),
text_ID (0),
Pair_And_Scale ("");


Once begin
//print (Instrument);
Comma = ",";
Pair_And_Scale = PairAndScale;

Button_0_Val = Text_New_S(date, Time_s -1,0,"Note #");
Button_1_Val = Text_New_S(date, Time_s -2,0," 1 ");
Button_2_Val = Text_New_S(date, Time_s -3,0," Rst #");
Button_3_Val = Text_New_S(date, Time_s ,0," 3 ");
Button_4_Val = Text_New_S(date, Time_s +1,0," 4 ");
Button_5_Val = Text_New_S(date, Time_s +2,0,"Jp To ");
Button_6_Val = Text_New_S(date, Time_s +3,0," 6 ");
Button_7_Val = Text_New_S(date, Time_s -1,0," 7 ");
Button_8_Val = Text_New_S(date, Time_s -1,0," 8 ");
Button_9_Val = Text_New_S(date, Time_s -1,0," Rmv A");
Button_ReCalc_Val = Text_New_S(date, Time_s -1,0,"ReCalc");

SetMenuAttribute(Button_1_Val);
SetMenuAttribute(Button_2_Val);
SetMenuAttribute(Button_3_Val);
SetMenuAttribute(Button_4_Val);
SetMenuAttribute(Button_5_Val);
SetMenuAttribute(Button_6_Val);
SetMenuAttribute(Button_7_Val);
SetMenuAttribute(Button_8_Val);
SetMenuAttribute(Button_9_Val);
SetMenuAttribute(Button_0_Val);
SetMenuAttribute(Button_Recalc_Val);

Text_SetStyle(button_recalc_Val,0,2);

ListID = ListS.New;

GetActive_PreviousValue = Activebutton;
end;

If LastBarOnChart then begin
//Get the location of the margin

HighestPrice = Getappinfo(aiHighestDispValue);
Lowestprice = Getappinfo(aiLowestDispValue);
RightMargin = Getappinfo(aiRightDispDateTime);
TheSpaceToRight = Getappinfo(aiSpacetoRight);
LeftDateTime = Getappinfo(aiLeftDispDateTime );
LeftSideOfScreenDate = JulianToDate(GetAppInfo(aiLeftDispDateTime));


TextVal = Text_setLocation_BN(Button_0_val,Barnumber + (TheSpaceToRight*.9), HighestPrice);
TextVal = Text_setLocation_BN(Button_1_val,Barnumber + (TheSpaceToRight*.9), (highestprice - (HighestPrice-Lowestprice) *.10));
TextVal = Text_setLocation_BN(Button_2_val,Barnumber + (TheSpaceToRight*.9), (HighestPrice - (HighestPrice-Lowestprice) *.20));
TextVal = Text_setLocation_BN(Button_3_val,Barnumber + (TheSpaceToRight*.9), (HighestPrice - (HighestPrice-Lowestprice) *.30));
TextVal = Text_setLocation_BN(Button_4_val,Barnumber + (TheSpaceToRight*.9), (HighestPrice - (HighestPrice-Lowestprice) *.40));
TextVal = Text_setLocation_BN(Button_5_val,Barnumber + (TheSpaceToRight*.9), (HighestPrice - (HighestPrice-Lowestprice) *.50));
TextVal = Text_setLocation_BN(Button_6_val,Barnumber + (TheSpaceToRight*.9), (HighestPrice - (HighestPrice-Lowestprice) *.60));
TextVal = Text_setLocation_BN(Button_7_val,Barnumber + (TheSpaceToRight*.9), (HighestPrice - (HighestPrice-Lowestprice) *.70));
TextVal = Text_setLocation_BN(Button_8_val,Barnumber + (TheSpaceToRight*.9), (HighestPrice - (HighestPrice-Lowestprice) *.80));
TextVal = Text_setLocation_BN(Button_9_val,Barnumber + (TheSpaceToRight*.9), (HighestPrice - (HighestPrice-Lowestprice) *.90));

TextVal = Text_SetLocation_s(Button_ReCalc_Val, LeftSideOfScreenDate, DateTime2ELTime_s(leftDateTime), HighestPrice );


ActiveButton= MC_Text_getactive;
// Print (activeButton:0:0);
If ActiveButton <> GetActive_PreviousValue then begin
// Print (ActiveButton:0:0, " ", GetActive_PreviousValue:0:0);
If activeButton = Button_0_Val then Capture_Text_Num;
If activeButton = Button_1_Val then begin
print ("go to function: ", text(Pair_And_Scale));
Boolean_Val = Open_Notes_File (text(Pair_And_Scale));
Print ("Return");
end;
If activeButton = Button_2_Val then Boolean_Val = Reset_Note_Number ;
If activeButton = Button_3_Val then playsound("C:\CLICK.WAV") ;
If activeButton = Button_4_Val then playsound("C:\CLICK.WAV") ;
If activebutton = Button_5_Val then Boolean_val = Centerfromarrow;
If activeButton = Button_6_Val then playsound("C:\CLICK.WAV") ;
If activeButton = Button_7_Val then playsound("C:\CLICK.WAV") ;
If activeButton = Button_8_Val then playsound("C:\CLICK.WAV") ;
If activeButton = Button_9_Val then Boolean_val = EraseArrow;
If activeButton = Button_Recalc_Val then recalculate;

GetActive_PreviousValue = Activebutton;
end;

end;

if MouseClickshiftPressed then begin
Amouseclick = True;
vClickBarNbr = MouseClickBarNumber;
//print ("MS: ", vClickBarNbr:0:0);
vclickdatetime = MouseClickDateTime;
vClickPrice = MouseClickPrice;
end;
If amouseclick = true then begin
vLastBar = BarNumber + MaxBarsBack;
vBarsAgo = vLastBar-vClickBarNbr ;

if vBarsAgo >= 0 then begin
vclickbarhigh = high[vBarsAgo];

vClickBarOpen_S = NumtoStr(Open[vBarsAgo],5);
vClickBarHigh_S = NumToStr(high[vBarsAgo],5);
vClickBarLow_S = NumToStr(low[vBarsAgo],5);
vClickBarClose_S = NumToStr(Close[vBarsago],5);
vClickPrice_S = numtostr(vClickPrice,5);
GvSetNamedString("BarInfo",vClickBarOpen_S + comma + vClickBarHigh_S + comma + vClickBarLow_s + comma + vClickBarClose_S + comma +
GetSymbolName+ comma + scale + comma + vClickPrice_S + comma + DateTimeToString(vclickdatetime));

Barinfo_Str = GVGetNamedString("BarInfo","Error");
filedelete("G:\BarInfo.txt");


fileappend("G:\BarInfo.txt",Barinfo_Str + comma + GetSymbolName + comma + scale +
comma + vClickPrice_S + comma + DateTimeToString(vclickdatetime));

//print ("O: ", vClickBarOpen_S, " H: ", vClickBarHigh_S, " L: ",vClickBarLow_S, " C: ", vClickBarClose_S , " CP: ", vClickPrice_S, "BN: ", MouseclickBarnumber, " DT: ", Mouseclickdatetime);
//playsound("C:\Program Files (x86)\Microsoft Office\Office14\MEDIA\CLICK.WAV") ;

Arw_New_DT(vclickdatetime, vClickPrice ,UpArrow);
//Print (vclickprice:5:5, " CDT: ", vclickdatetime:10:10, " LTC: ", (LastCalcJDate +(LastCalcSSTime * ELTimeToDateTime_s(1))):10:10); //vClickBarNbr:0:0, " ", (barnumber + maxbarsback ));

DateTime2ELTime(GetAppInfo(aiRightDispDateTime));

//print (vclickprice:5:5, " ", upperpart:5:5, " ", vClickBarNbr:0:5 , " " , (barnumber + maxbarsback )) ;

If vClickPrice > high[vBarsAgo] then
Astring = "LONG" + comma + vClickBarOpen_S + comma + vClickBarClose_S
else
Astring = "SHORT" + comma + vClickBarClose_S + vClickBarOpen_S ;

GVVal = GVSetNamedString("A_BAR_DATA",astring + comma + GetSymbolName + comma + scalestring );
GVVal = GVSetNamedString("Time_Date_DATA", numtostr(vclickdatetime,2));

Once begin
CharPos = Instr(Filename,".");
PairName = (Leftstr(FileName, charpos-1)+ midstr(Filename,charpos+1,3) + "_");
filename_B = (Leftstr(FileName, charpos-1)+ midstr(Filename,charpos+1,3) + "_" + midstr(Filename,charpos+4,20));

end;


if (MouseClickCtrlPressed and MouseClickShiftPressed) then begin
//Print ("Ctrl + Shift");
ClickTime = MouseClickDateTime;
BN = MouseClickBarNumber;
PriceVal = MouseClickPrice;

ValToShow = GVGetNamedInt("Filename_B",0);
GVSetNamedInt("Filename_B",ValtoShow + 1);
Text_ID = text_new_BN(BN, PriceVal, numtostr(ValtoShow,0));
Text_SetBorder(Text_ID, True);
text_SetColor(Text_ID,DarkBrown);
text_setsize(Text_ID,10);
text_setfontname(Text_ID,"Verdana");

end;

Text_ID = text_Getactive;

{ clickonmargin = false;

If vclickdatetime -.00002 > (LastCalcJDate +(LastCalcSSTime * ELTimeToDateTime_s(1))) then begin
// print ("bn ", BarNumberOfTheLastBar:0:0, " ", "vc ",vClickBarNbr:0:0, " VCT: ",vclickdatetime) ;

ClickonMargin = true;


Button_1_High = Highestprice;
Button_1_Low = HighestPrice - (.1 * (HighestPrice-LowestPrice));

Button_2_High = highestprice - ((HighestPrice-Lowestprice) *.20);
Button_2_Low = HighestPrice - ((HighestPrice-lowestprice) *.30);

Button_3_High = highestprice - ((HighestPrice-Lowestprice) *.45);
Button_3_Low = HighestPrice - ((HighestPrice-lowestprice) *.55);

Button_4_High = highestprice - ((HighestPrice-Lowestprice) *.70);
Button_4_Low = HighestPrice - ((HighestPrice-lowestprice) *.80);

Button_5_High = HighestPrice - (.90 * (HighestPrice-LowestPrice));
Button_5_Low = Lowestprice;

// print (Button_1_High:5:5, " ", Button_1_Low:5:5 );

If VclickPrice <= Button_1_High and vClickPrice >= Button_1_Low then Button_1 = True;
If VclickPrice <= Button_2_High and vClickPrice >= Button_2_Low then Button_2 = True;
If VclickPrice <= Button_3_High and vClickPrice >= Button_3_Low then Button_3 = True;
If VclickPrice <= Button_4_High and vClickPrice >= Button_4_Low then Button_4 = True;
If VclickPrice <= Button_5_High and vClickPrice >= Button_5_Low then Button_5 = True;
end;

If Button_1 = true then begin
if GVGetNamedString("ShowPrevDayTime","Error SetShoPrevDay") = "True" then GVSetNamedString("ShowPrevDayTime" , "False" )
else begin
GVSetNamedString("ShowPrevDayTime" , "True" );
end;
//Print (GVGetNamedString("ShowPrevDayTime","Error SetShoPrevDay"));
end;

if clickonmargin = true then begin
If button_2 = true then begin

playsound("G:\Users\Utilisateur\Documents\Bourse\Sound\Button 2.wav");
ShowLineForThelastprice;
end;
//If Button_3 = true then Boolean_val = Centerfromarrow;

If button_4 = true then Boolean_val = EraseArrow;

If Button_5 = true then begin
print("Button 5");
//playsound("C:\Program Files (x86)\Microsoft Office\root\Office16\MEDIA\CLICK.WAV") ;
playsound("C:\CLICK.WAV") ;


end ;

end;}
end;
end;

If amouseclick = true and lastbaronchart_S then begin
//print ("amouse click");
amouseclick = false;
//If ClickonMargin = false then playsound("C:\Program Files\Microsoft Office 15\root\office15\MEDIA\CLICK.WAV") ;
If ClickonMargin = false then playsound("G:\Users\Utilisateur\Documents\Bourse\Sound\Click.wav");

//Print ("Click");
clickonmargin = false;
end;

If mouseclickctrlpressed then begin
amouseclick_ctrl = True;
VClickDateTime_CTRL = MouseClickDateTime;
GVVal = GVSetNamedString("Time_Date_DATA", numtostr( VClickDateTime_CTRL ,2));

end;

If amouseclick_CTRL = true and lastbaronchart_S then amouseclick_CTRL = false;

Value1 = Text_GetFirst(6);

mickatrade
Posts: 114
Joined: 12 Jul 2015
Has thanked: 20 times
Been thanked: 16 times

Re: New Hotkeys for Multicharts

Postby mickatrade » 05 Jan 2016

@sptrader, great idea too, we can also suggest a button in the DOM to close half of position.

@arjfca, Bien joué !!!!
I will look your code to add the spread directly on my charts.
Merci beaucoup .

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: New Hotkeys for Multicharts

Postby arjfca » 05 Jan 2016

@sptrader, great idea too, we can also suggest a button in the DOM to close half of position.

@arjfca, Bien joué !!!!
I will look your code to add the spread directly on my charts.
Merci beaucoup .
Glad to hear that it was useful for you.
Saw that you succeed to code for the spread display on charts.

Martin

mickatrade
Posts: 114
Joined: 12 Jul 2015
Has thanked: 20 times
Been thanked: 16 times

Re: New Hotkeys for Multicharts

Postby mickatrade » 08 Jan 2016

Hello the Dev team,

Any chance to have this kind of feature for MC .

User avatar
bensat
Posts: 331
Joined: 04 Oct 2014
Has thanked: 46 times
Been thanked: 104 times

Re: New Hotkeys for Multicharts

Postby bensat » 09 Jan 2016

Someone already realized/finished it and is selling it over the internet ... As I'm not willing or allowed to advertise, make some Google research ....

Regards

Ben

mickatrade
Posts: 114
Joined: 12 Jul 2015
Has thanked: 20 times
Been thanked: 16 times

Re: New Hotkeys for Multicharts

Postby mickatrade » 09 Jan 2016

Someone already realized/finished it and is selling it over the internet ... As I'm not willing or allowed to advertise, make some Google research ....

Regards

Ben
Hello Ben, i've found it but it seems to work with automatic strategies . I'm a discretionnary trader so it will be better if this hotkey is added by the dev team. It'd be great to take partial profit on stocks or forex.

Mickael.

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: New Hotkeys for Multicharts

Postby JoshM » 10 Jan 2016

I couldn't find that tool/product, and I'm a little sceptical if it's possible to code your own hotkeys. The only way that I know of is the approach shared by Martin above, and I couldn't find anything in the SDK suggesting that custom hotkeys are possible with a DLL. Even if we register a hotkey (say Ctrl + Alt + H), then we'll still need to connect it to a certain action (like applying an exit strategy from the Chart Trader). I don't think those events are exposed programmatically to us, but I hope I'm mistaken because it would be great if we could do this.

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: New Hotkeys for Multicharts

Postby arjfca » 10 Jan 2016

An idea that I just got, but it has been suggested before

- Code a key sequence using AutoHotKey to execute your task to close a % portion of a trade position and compile the code to an an .exe file Let called it "MyPartialClose.exe".

- Code a MC function that when been called will start the MyPartialClose.exe.
Let call MC function "DiscretionaryClosing"

- Code a button like mine and link it to the function "DiscretionaryClosing"

There maybe other more fancy way to do it. For me, I resolved the problem by closing directly my trade on my broker server

I designed an Excel platform where
- I capture data on MC using MouseClick
- Transfer the data on Excel using Macro
- Using the data and a set of different macro, I create an order, I could select the type of entry, the stop the exit, the profit, the quantity, the risk etc. Once the order parameter has been set, I send the order from Excel to the broker using another macro

- Since the coding process is not terminated in Excel, I then managed my order or position directly on my broker server. My orders do reside on IB server, not on my PC where I can:

- Cancelled orders manually
- Close before stop or profit target reached
- Close partially

This way, I got control over all aspect of my orders, but not on... *** "my trading emotions" lol

*** My main problems...

Martin

N.B. If I recall, there is an indicator or signal somewhere that allow to trade from the charts using trendline. Where entry, stop & target are set using trendline. If you want to close your trade, you move the stop trendline to the desired position and the trade will be close at the next tick. Maybe by using different color of trendline , you may be able to set the % of position to be closed

mickatrade
Posts: 114
Joined: 12 Jul 2015
Has thanked: 20 times
Been thanked: 16 times

Re: New Hotkeys for Multicharts

Postby mickatrade » 23 Jan 2016

Hi all,

I've just created a request to had this type of hotkeys in MC.
Please vote if you think it's an interesting functionnality :

https://www.multicharts.com/pm/viewissu ... no=MC-1994

Regards,

MJ


Return to “MultiCharts”