Termos de Referência
In the attach image you will find the function that is the core of the entire notebook ( https://colab.research.google.com/drive/1jVZ0R_MSMHS5DQrPa399fyioEvI2zn5S?usp=sharing)
I need to change this function from itinerating with lengths to itinerating trough columns that have values as 1 and 0 where 1 is to enter or close a Long trade and 0 is to do nothing.
This exercise is only intended to find the best combination for Long trades. I do not need short trades.
On the next lines a short description of what the code does and what the code should do:
What the code actually do:
1 Provides the data frame where the code should run
2 Establish which technical indicators should be use
3 Defines the variable that allows the system to iterate with different lengths
4 Creates the input variable to create the trading logic
5 I THINK creates the loop for running all over the data frame
6 creates the trading logic:
Long position: sma_diff >0 Long
Short Position: sma_diff <0 Short
Entering and closing trades: if the previous signal is equal to actual signal do nothing
If actual signal is Short and previous was long, close Long trade and open Short trade
If actual signal is Long and previous was Short, close Short trade and open Long Trade
What the code should do:
1 Maintain the same data frame
2 instead of defining the indicators select and create all possible combinations from a series of columns that Start with the Long word
3 The columns have 2 values, 1 and 0, 1 means to enter or close and 0 means do nothing.
4 Logic:
If the system find the value 1 in one column or in all columns from the combination provide by the iteration ENTER Or Close the trade
If the system finds in a combination of 3 columns the next values (1,0,1) this means do nothing.
The objective is to find the most profitable combination for Long trades according to the preestablish indicators.
The rest of notebook must be adjust to these new logic and also need to get a cdv file where I can find the next info:
And finally I will need csv file that contains the next info:
Open Trade Date-Time
Open Trade Close Price
Close Trade Date-Time
Close Trade Close Price
Trade Type (Long / Short)
In these 2 videos you will find the description from the original notebook:
Part # 1 (10 min)
Part # 2 (7 min)