Auto Entry vs Manual Exit

Questions about MultiCharts and user contributed studies.
User avatar
Mark Brown
Posts: 182
Joined: 29 Nov 2016
Has thanked: 114 times
Been thanked: 18 times

Auto Entry vs Manual Exit

Postby Mark Brown » 18 Mar 2024

What it does correct

Code will auto entry and you can manually exit trade as desired.

What it does incorrect

It will not take another trade after the first trade. You must turn off auto trading and turn it back on. When you turn auto trading back on it puts you automatically into some random position which will always be a loss.

The position tracking shows the position to be closed why is it placing or reentering the last trade?

m


Code: Select all

// Define variables for entry signal and position status Vars: longEntrySignal(false), positionOpen(false); // Automated entry logic (example using a condition) if t > t[1] then longEntrySignal = true; // Set entry signal to true for automated entry // Entry execution if longEntrySignal then begin // Execute automated entry logic here (e.g., place a buy market order) // Once the order is filled, the system will be long one contract buy this bar c; Value13 = arw_new_s(Date,time_s,low,False); arw_setsize(value13,0); arw_setstyle(value13,4); arw_setcolor(value13,green); Print("Automated entry executed at ", Date, " ", Time_s, " - Price: ", open); // Print entry information longEntrySignal = false; // Reset entry signal positionOpen = true; // Set position status to open end; // Manual exit logic (example using a condition) // Note: Manual exit logic is separated from entry logic to allow for manual exits // This example uses a condition for demonstration purposes, replace it with your actual exit logic if High > Highest(High, 2)[1] then begin // No action is taken here for manual exit // Manual exits will be performed manually by the trader // You can add alerts or prompts to notify the trader about potential exit conditions Print("Manual exit condition detected at ", Date, " ", Time_s, " - Please manually exit the position"); positionOpen = false; // Set position status to closed end; // Plot an arrow at the current bar to indicate manual exit if not positionOpen then begin Value14 = arw_new_s(Date,time_s,low,False); arw_setsize(value14,0); arw_setstyle(value14,4); arw_setcolor(value14,red); end; // Print position status for debugging Print("Position Open: ", positionOpen);

Return to “MultiCharts”