Hello, How do I add a new parameter to AdviseLong function
Below code, I wanted to add the Close[0] as a parameter to the adviseLong Funtion, however didn't work. I normalize it also.
.........................
vars Open = series(priceOpen()); vars High = series(priceHigh()); vars Low = series(priceLow()); vars Close= series(priceClose()); vars Price = series(price()); ColorUp = BLUE; ColorDn = MAGENTA;
#ifdef DO_SIGNALS SelectWFO = -1; // use the last WFO cycle for calibrating the neural net if((vLong = adviseLong(SIGNALS+BALANCED,0, #else set(LOGFILE|PLOTNOW); if((vLong = adviseLong(NEURAL+BALANCED,0, #endif change(1),change(2),change(3),change(4), range(1),range(2),range(3),range(4),Close[0]/100))> Threshold) enterLong(); #ifndef DO_SIGNALS if((vShort = adviseShort()) > Threshold) enterShort(); #endif plot("Long",vLong,NEW|LINE,BLACK); plot("Short",vShort,LINE,GREY); }
Last edited by NewtraderX; 12/31/2304:41.
Re: DeepLearn, introduce new feature
[Re: NewtraderX]
#488028 12/31/2306:5412/31/2306:54
Please tell us what you know about built-in functions and user-defined functions. So we can help you more efficiently.
The reason is because the two have their limitations and advantages. But Disadvantages are always flexible enough to change into advantages. Thank you.
Thank you for your response, The reason I asked you the question because I suppose you already know what are the definitions of user-defined functions, and built-in functions,
You gave me examples of user-defined functions, but not the definition of what is user-defined functions, and the difference between built-in Functions.
But let's suppose you know the difference in the definition, If you know what output you are expecting from the built-in function, and you can create a user-defined function with the built-in function, this is a partial solution to your problem. I know we are all here to improve on our mathematical programming abilities to improve our sophistication, but there are many solutions to your problems, some of them are very easy, with a lack of efficiency and accuracy, and others are much more sophisticated, and at a higher level of accuracy relative to what kind of output solutions you expect to be satisfied with.
You can create a custom function that accepts any number of parameters inputs those parameters with a loop into the adviseLONG or SHORT, and then uses the output to input once again into the built-in functions, this is the easy solution. But the solution has somewhat a lack of accuracy, compared to a Custom Neural Network that will accept a larger number of parameters.
I am sorry you got the wrong impression, that was not my intention.
I gave you an answer that is a general solution, my approach to computer science, and programming is focused on giving a general answer, that would be suitable to any problem. and it is for you to make sense of it, according to your mindset, and ideas.
And I love thinking for myself and finding out solutions as my abilities improve.
If you want an easy solution without developing ideas by yourself, it would be hard for me to know what kind of approach you prefer, the easy one, without a high level of accuracy, or the more complex one, which is a custom-defined Neural Network. Please do forgive my enthusiasm in helping you by the approach I would expect others to help me.
Thank you for your consideration and understanding.
Code
function run() {
set(PARAMETERS);
StartDate = 20190101;
BarPeriod = 60;
Capital = 2000;
LookBack = 150;
vars Open = series(priceOpen());
vars High = series(priceHigh());
vars Low = series(priceLow());
vars Close = series(priceClose());
// Additional input: normalized close
vars NormClose = series(Close[0] / 100);
int NumSignals = 5; // Number of total input signals
vars Signals = series(NumSignals);
// Manually calculate the change for each series
Signals[0] = Open[0] - Open[1]; // Change for Open
Signals[1] = High[0] - High[1]; // Change for High
Signals[2] = Low[0] - Low[1]; // Change for Low
Signals[3] = Close[0] - Close[1]; // Change for Close
Signals[4] = NormClose[0]; // Normalized Close
var vLong, vShort, Threshold = 0.5;
set(LOGFILE | PLOTNOW);
// Advise functions with the signal array
if (adviseLong(NEURAL + BALANCED, 0, Signals, NumSignals) > Threshold)
enterLong();
if (adviseShort(NEURAL + BALANCED, 0, Signals, NumSignals) > Threshold)
enterShort();
plot("Long", vLong, NEW|LINE, BLACK);
plot("Short", vShort, LINE, GREY);
}
I hope this makes you happy... And Happy New Year to our challenging minds.
Well, there are even more sophisticated approaches, that need even more modifications. Please accept my apology as I am learning new ideas, to contribute to our community of creative thinking. Thank you.
Code
function run() {
set(PARAMETERS);
StartDate = 20190101;
BarPeriod = 60;
Capital = 2000;
LookBack = 150;
vars Open = series(priceOpen());
vars High = series(priceHigh());
vars Low = series(priceLow());
vars Close = series(priceClose());
vars NormClose = series(Close[0] / 100);
int NumSignalsFirstLayer = 5; // Number of signals for the first neural network
vars SignalsFirstLayer = series(NumSignalsFirstLayer);
SignalsFirstLayer[0] = Open[0] - Open[1];
SignalsFirstLayer[1] = High[0] - High[1];
SignalsFirstLayer[2] = Low[0] - Low[1];
SignalsFirstLayer[3] = Close[0] - Close[1];
SignalsFirstLayer[4] = NormClose[0];
// Outputs from the first layer
var LongOutputFirstLayer = adviseLong(NEURAL + BALANCED, 0, SignalsFirstLayer, NumSignalsFirstLayer);
var ShortOutputFirstLayer = adviseShort(NEURAL + BALANCED, 0, SignalsFirstLayer, NumSignalsFirstLayer);
int NumSignalsSecondLayer = 2; // Number of signals for the second neural network
vars SignalsSecondLayer = series(NumSignalsSecondLayer);
// Use the outputs from the first layer as inputs for the second layer
SignalsSecondLayer[0] = LongOutputFirstLayer;
SignalsSecondLayer[1] = ShortOutputFirstLayer;
var vLong, vShort, Threshold = 0.5;
set(LOGFILE | PLOTNOW);
if (adviseLong(NEURAL + BALANCED, 0, SignalsSecondLayer, NumSignalsSecondLayer) > Threshold)
enterLong();
if (adviseShort(NEURAL + BALANCED, 0, SignalsSecondLayer, NumSignalsSecondLayer) > Threshold)
enterShort();
plot("Long", vLong, NEW|LINE, BLACK);
plot("Short", vShort, LINE, GREY);
}