I am looking for simple code to exit the trade when weekly signal close?
The strategy i am working on is using weekly signals which enters the trade if weekly candle from previous week closed above SMA5 and exit that trade at the end of the week (i.e. Friday close of market).
so in the strategy how do i write the code to close the trade at the end of Friday ?
Good morning. First you have to define the indicators in the weekly timeframe and then go down to a timeframe lower than the daily one so that it allows you to close before the market closes. For example, if you use a 1H timeframe then you can close the position on Friday at 21:00. It would be something like this:
why is the time frame used 21000 or 20000 ? what does 3pm means ? as currently code sell stock at 4pm in Australia time which is basically not the best time to sell stock and i want to set it as 3pm then what will be time value ?
Hi!
Sorry… I wrote the code for Europe…
In Spain NYSE ends at 22:00, so that’s why I wrote 21:00. In Australia you should write the correct time.
You just need to change time and it will work.
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue