Support Board
Date/Time: Wed, 27 Nov 2024 06:49:11 +0000
Post From: Keyboard Shortcuts for Send Attached Orders and Adjusting Attached Orders
[2014-04-27 11:21:38] |
norvik - Posts: 22 |
RMF2, you can make yourself any hotkey you like. #include<windows.h>
#include "C:\SierraChart\ACS_Source\sierrachart.h" SCDLLName("ChartTrader Orders One Click Managment") SCSFExport scsf_ChartTraderOrdersOneClickManagment(SCStudyInterfaceRef sc) { SCInputRef ToolId = sc.Input[0]; SCInputRef Enabled = sc.Input[1]; if (sc.SetDefaults) { sc.GraphName = "ChartTrader Orders One Click Managment"; sc.StudyDescription = ""; sc.AutoLoop = 1; sc.GraphRegion = 0; sc.FreeDLL = 0; sc.CalculationPrecedence = LOW_PREC_LEVEL; ToolId.Name = "ACS Tool # ToolBar button for Enable/Disable"; ToolId.SetInt(1); ToolId.SetIntLimits(1,50); Enabled.Name = "Enabled"; Enabled.SetYesNo(0); sc.ReceiveMousePointerEvents = 1; return; } int& MenuID = sc.PersistVars->i1; double & LastModifyPrice = sc.PersistVars->d1; if (sc.UpdateStartIndex == 0) { sc.SetACSToolButtonText(ToolId.GetInt(), "TMC"); sc.SetACSToolEnable(ToolId.GetInt(), Enabled.GetBoolean() != 0 ); LastModifyPrice = 0.0; } sc.SendOrdersToTradeService = !sc.GlobalTradeSimulationIsOn; SHORT nKeyLeftShift= GetAsyncKeyState(VK_LSHIFT); SHORT nKeyLeftControl = GetAsyncKeyState( VK_LCONTROL ); s_SCPositionData PositionData; sc.GetTradePosition(PositionData); double NewPrice; s_SCTradeOrder Order; int Result; if (( 0 != nKeyLeftShift )&&( PositionData.PositionQuantity <0 )) Result = sc.GetNearestStopOrder(Order); else if (( 0 != nKeyLeftControl )&&( PositionData.PositionQuantity >0 )) Result = sc.GetNearestStopOrder(Order); else if (( 0 != nKeyLeftShift )&&( PositionData.PositionQuantity >0 )) Result = sc.GetNearestTargetOrder(Order); else if (( 0 != nKeyLeftControl )&&( PositionData.PositionQuantity <0 )) Result = sc.GetNearestTargetOrder(Order); if ((( 0 != nKeyLeftShift )||(0 != nKeyLeftControl ))&&(sc.MenuEventID != 0)) { if (sc.MenuEventID == ToolId.GetInt()) { if (sc.MouseEventType == SC_MOUSE_DOWN) { NewPrice = sc.ActiveToolYValue; NewPrice= sc.RoundToTickSize(NewPrice); if(NewPrice == LastModifyPrice || sc.FormattedEvaluateUsingDoubles(Order.Price1,sc.ValueFormat, EQUAL_OPERATOR,NewPrice, sc.ValueFormat ) ) return; LastModifyPrice = NewPrice; s_SCNewOrder ModifyOrder; ModifyOrder.InternalOrderID = Order.InternalOrderID; ModifyOrder.Price1 = NewPrice; Result = sc.ModifyOrder(ModifyOrder); } } } } |