Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

For else error and vector integration

1 visualización (últimos 30 días)
Tomasz Mlynowski
Tomasz Mlynowski el 7 de Jul. de 2012
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
I am trying to convert a (for if else) condition into a vector. I am having problems running the results after because I need to redefine the different Short and Long trades to be read as directionTrade i think. not sure what I am doing incorrectly.
I need to convert: -
if dist(k,i)>0
B_Short(k,i)=-1;
B_Long(k,p(i,1))=+1;
else
B_Short(k,p(i,1))=-1;
B_Long(k,i)=+1;
end
INTO......................
for i=1:length(idx)
if (dist(k,idx(i))>0)
myTrades{idxTrades,1}.directionTrade1=[-1 1];
else
myTrades{idxTrades,1}.directionTrade2=[ 1 -1];
Attempted added information Below. Not sure if correct...
directionTrade1=[B_Short(k,i) B_Long(k,p(i,1))];
directionTrade2=[B_Long(k,i) B_Short(k,p(i,1))];
This is where the problem arises.
% Calculation of the Total Buy_Signs Matrix
BsignsT(k,:)=B_Long(k,:)+B_Short(k,:);
Because it still reads B Long and B Short trades however I want to replace with the above vector else conditon. What do I need to change? and what do I need to change the name to for all recurrences of B Short and B Long in the remaining code for it to correctly read the newly changed vector and process the fucntion correctly..???

Respuestas (0)

La pregunta está cerrada.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by