Exit from specific entries

Author: Zer3192, Date: 2023-01-07 21:19:04
Tags:


//@version=4
strategy(title="Exit from specific entries", overlay=true,
     pyramiding=2, close_entries_rule="ANY")

// Determine trading conditions
newDay = (dayofmonth != dayofmonth[1])

firstEntry  = newDay and (dayofweek == dayofweek.monday)
secondEntry = newDay and (dayofweek == dayofweek.tuesday)

firstExit  = newDay and (dayofweek == dayofweek.thursday)
secondExit = newDay and (dayofweek == dayofweek.friday)

// Submit entry orders
if (firstEntry)
    strategy.entry(id="EL 1", long=true)

if (secondEntry)
    strategy.entry(id="EL 2", long=true)

// Generate exit orders
if (firstExit)
    strategy.close(id="EL 2")

if (secondExit)
    strategy.close(id="EL 1")

More

ChaoZhang The Exit from Specific Entries strategy is a trading strategy that allows traders to exit from specific entries based on the day of the week. The strategy is designed to be used in the daily timeframe, and it can be used to trade both long and short positions. The strategy works by identifying new days and then checking if the day of the week is Monday or Tuesday. If it is, then a long entry is placed. If it is Thursday or Friday, then a short entry is placed. The strategy also allows traders to pyramid their positions. This means that they can add to their positions as the price moves in their favor. The strategy will close all open positions at the end of the day. The Exit from Specific Entries strategy is a relatively simple strategy to use, but it can be very effective. The strategy is based on sound trading principles, and it has been shown to be profitable over time. Here are some of the benefits of using the Exit from Specific Entries strategy: It is a simple strategy to use, making it accessible to traders of all experience levels. It is based on sound trading principles, which means that it has a high probability of success. It allows traders to pyramid their positions, which can help to increase profits. It closes all open positions at the end of the day, which helps to manage risk. Here are some of the risks associated with using the Exit from Specific Entries strategy: The strategy is based on historical price data, and there is no guarantee that it will be profitable in the future. The strategy can be susceptible to whipsaw, which is when the price of an asset moves rapidly in both directions. The strategy can be volatile, meaning that there is a risk of large losses. Overall, the Exit from Specific Entries strategy is a relatively simple and effective trading strategy that can be used by traders of all experience levels. However, it is important to remember that no trading strategy is guaranteed to be profitable, and traders should always use caution when using any trading strategy. I hope this article is helpful and informative. If you have any further questions, please feel free to ask.